Clone wiki

satchmo / BackwardsIncompatibleChangesAfter0.8

Backwards Incompatible Changes After 0.8.1

  • Aug 06, 2009 Contact Changes

Module Reorganization

In [1863], we merged the module-reorg branch to head. This is a major change, and all stores who intend to track head must manually upgrade to be compatible.

'''Directory Changes:''' The base satchmo directory is now as follows:

  • apps - where all the satchmo apps live. This must be on your pythonpath.
  • projects - Sample apps and boilerplate settings files.
  • static - the combined store static directory.

'''Models Moved'''

  • tax.models.TaxClass to satchmo_store.product
  • tax.models.TaxRate to tax.models.modules.area

'''App Moves:'''

''Update your INSTALLED_APPS to use the new names. In addition if you have any custom apps which import from Satchmo, you'll need to update the imports as follows.''

  • satchmo.accounts to satchmo_store.accounts
  • satchmo.caching to keyedcache
  • satchmo.configuration to livesettings
  • satchmo.contact to satchmo_store.contact
  • satchmo.contrib to satchmo_ext.contrib
  • satchmo.feeds to satchmo_ext.product_feeds
  • satchmo.giftcertificate to payment.modules.giftcertificate
  • satchmo.l10n to l10n
  • satchmo.metrics to satchmo_ext.metrics
  • satchmo.newsletter to satchmo_ext.newsletter
  • satchmo.payment to payment
  • satchmo.product to product
  • satchmo.product.brand to satchmo_ext.brand
  • satchmo.product.tieredpricing to satchmo_ext.tieredpricing
  • satchmo.productratings to satchmo_ext.productratings
  • satchmo.recentlist to satchmo_ext.recentlist
  • satchmo.shipping to shipping
  • satchmo.shop to satchmo_store.shop
  • satchmo.supplier to satchmo_store.contact.supplier
  • satchmo.tax to tax
  • satchmo.thumbnail to satchmo_utils.thumbnail
  • satchmo.upsell to satchmo_ext.upsell
  • satchmo.utils to satchmo_utils
  • satchmo.wishlist to satchmo_ext.wishlist

'''Localization:'''

Split up into locales for each app.

'''Settings:'''

tax.area and tax.no are no longer automatically imported, they need to be in INSTALLED_APPS

'''Dependencies:'''

  • Added app_plugins as a required dependency.
  • You must also update django_threaded_multihost and the optional dependency django-testimonials to use the latest versions.

'''SQL Updates:'''

(Postgres)

alter table shop_config drop column no_stock_checkout;
alter table discount_discount rename to product_discount;
alter table configuration_setting rename to livesettings_setting;
alter table configuration_longsetting rename to livesettings_longsetting;
alter table discount_discount_id_seq rename to product_discount_id_seq; 
alter table configuration_setting_id_seq rename to livesettings_setting_id_seq; 
alter table configuration_longsetting_id_seq rename to livesettings_longsetting_id_seq;
alter table "discount_discount_validProducts" rename to "product_discount_validProducts";

(MySQL)

alter table shop_config drop column no_stock_checkout;
rename table `discount_discount` to `product_discount`;
rename table `configuration_setting` to `livesettings_setting`;
rename table `configuration_longsetting` to `livesettings_longsetting`;

(Sqlite)

alter table discount_discount rename to product_discount;
alter table configuration_setting rename to livesettings_setting;
alter table configuration_longsetting rename to livesettings_longsetting;

'''Configuration Moves:'''

  • NUM_PAGINATED from shop to product
  • NUM_DISPLAY from shop to product
  • MEASUREMENT_SYSTEM from shop to product
  • RANDOM_FEATURED from shop to product
  • RECENT_MAX from shop to product
  • CURRENCY from shop to l10n

Sql for these updates:

update livesettings_setting set group='PRODUCT' where group='SHOP' and key='NUM_PAGINATED';
update livesettings_setting set group='PRODUCT' where group='SHOP' and key='NUM_DISPLAY';
update livesettings_setting set group='PRODUCT' where group='SHOP' and key='MEASUREMENT_SYSTEM';
update livesettings_setting set group='PRODUCT' where group='SHOP' and key='RANDOM_FEATURED';
update livesettings_setting set group='PRODUCT' where group='SHOP' and key='RECENT_MAX';
update livesettings_setting set group='LANGUAGE' where group='SHOP' and key='CURRENCY';

(Postgres)

update livesettings_setting set "group"='PRODUCT' where "group"='SHOP' and key='NUM_PAGINATED';
update livesettings_setting set "group"='PRODUCT' where "group"='SHOP' and key='NUM_DISPLAY';
update livesettings_setting set "group"='PRODUCT' where "group"='SHOP' and key='MEASUREMENT_SYSTEM';
update livesettings_setting set "group"='PRODUCT' where "group"='SHOP' and key='RANDOM_FEATURED';
update livesettings_setting set "group"='PRODUCT' where "group"='SHOP' and key='RECENT_MAX';
update livesettings_setting set "group"='LANGUAGE' where "group"='SHOP' and key='CURRENCY';

'''HTML:''' renamed css class "sidebar" to "sidebar-primary" in templates.

'''Template Moves:'''

''If you've copied all templates, then you'll have to make these moves manually. You should take this opportunity to prune out all files which you haven't modified from the original. It is more maintainable to only modify the files you've changed.

There are several files which now use a much simpler and more configurable system which supports pluggable configuration. I strongly recommend you do not simply copy over all the old templates. Instead only move the templates you have changed, and only then after looking at the original to see if it uses the app_plugins tag library. If so, you'll need to update your template to use the new style.''

  • templates/404.html to satchmo_store/shop/templates/404.html
  • templates/500.html to satchmo_store/shop/templates/500.html
  • templates/admin/charge_remaining_confirm.html to payment/templates/admin/charge_remaining_confirm.html
  • templates/admin/_customproduct_management.html to satchmo_store/templates/shop/admin/_customorder_management.html
  • templates/base_cart.html to satchmo_store/templates/shop/cart.html
  • templates/base_category.html to product/templates/product/category.html
  • templates/base_index.html to satchmo_store/templates/shop/index.html
  • templates/base_product.html to product/templates/product/product.html
  • templates/checkout to satchmo_store/templates/shop/checkout/
  • templates/comments to satchmo_store/contact/templates/comments
  • templates/comments/product_rating_form.html to satchmo_ext/templates/productratings/
  • templates/configuration to livesettings/templates/livesettings
  • templates/contact to satchmo_store/contact/templates/contact
  • templates/contact_form.html to satchmo_store/shop/templates/shop/contact_form.html
  • templates/discount/checkout_form.html to product/templates/product/sale_details.html
  • templates/discount/product_eligible.html to product/templates/product/product_discount_eligible.html
  • templates/discount/some_eligible.html to product/templates/product/some_discount_eligible.html
  • templates/download.html to satchmo_store/shop/templates/shop/download.html
  • templates/email to satchmo_store/shop/templates/shop/email/
  • templates/google-analytics to satchmo_store/shop/templates/shop/google-analytics/
  • templates/json.html to satchmo_store/shop/templates/shop/json.html
  • templates/l10n to l10n/templates/l10n
  • templates/login_signup.html to satchmo_store/contact/templates/contact/login_signup.html
  • templates/login_signup_address.html to satchmo_store/contact/templates/contact/login_signup_address.html
  • templates/newsletter to satchmo_ext/newsletter/templates/newsletter
  • templates/payment to payment/templates/payment/
  • templates/pdf to satchmo_store/shop/templates/shop/pdf
  • templates/product to product/templates/product
  • templates/productratings/* to productratings/templates/
  • templates/registration to contact/templates/registration
  • templates/search.html to satchmo_store/shop/templates/shop/
  • templates/shipping to shipping/templates/shipping
  • templates/shipping_options.html to shipping/templates/shipping/options.html
  • templates/shop to satchmo_store/shop/templates/shop
  • templates/shop_404.html to satchmo_store/shop/templates/shop/404.html
  • templates/thanks.html to satchmo_store/shop/templates/shop/contact_thanks.html
  • templates/upsell/ to satchmo_ext/upsell/templates/upsell/
  • templates/widget/ to satchmo_utils/thumbnail/templates/widget/
  • templates/wishlist to satchmo_ext/wishlist/templates/wishlist/
  • templates/_messages.html to satchmo_store/shop/templates/shop/_messages.html
  • templates/_search.html to satchmo_store/shop/templates/shop/_search.html

sorl-thumbnail

In [1869], we added a dependency on sorl-thumbnail. Installation instructions are in the [http://www.satchmoproject.com/docs/svn/new_installation.html#installing-dependencies installation docs].

Decimal Inventory

In [1902], we modified all inventory units, changing from integers to decimals. This is because many products sold in the real world are done so in fractional units. Other than the SQL below, please inspect the satchmo default templates for the use of "normalize_decimal" on your custom product pages and carts.

'''SQL Updates'''

(PostgreSQL)

alter table product_price alter column quantity numeric(18,6);
alter table product_product alter column items_in_stock numeric(18,6);
alter table product_product alter column total_sold numeric(18,6);
alter table product_productpricelookup alter column items_in_stock numeric(18,6);
alter table product_productpricelookup alter column quantity numeric(18,6);
alter table shop_cartitem alter column quantity numeric(18,6);
alter table shop_orderitem alter column quantity numeric(18,6);
alter table supplier_rawitem alter column inventory numeric(18,6);
alter table tieredpricing_tieredprice alter column quantity numeric(18,6);
alter table tieredquantity_quantitytier alter column quantity numeric(18,6);

(PostgreSQL 8.3.5)

alter table product_price alter column quantity type numeric(18,6);
alter table product_product alter column items_in_stock type numeric(18,6);
alter table product_product alter column total_sold type numeric(18,6);
alter table product_productpricelookup alter column items_in_stock type numeric(18,6);
alter table product_productpricelookup alter column quantity type numeric(18,6);
alter table shop_cartitem alter column quantity type numeric(18,6);
alter table shop_orderitem alter column quantity type numeric(18,6);
alter table supplier_rawitem alter column inventory type numeric(18,6);
alter table tieredpricing_tieredprice alter column quantity type numeric(18,6);
alter table tieredquantity_quantitytier alter column quantity type numeric(18,6);

(MySQL)

alter table product_price modify column quantity numeric(18,6);
alter table product_product modify column items_in_stock numeric(18,6);
alter table product_product modify column total_sold numeric(18,6);
alter table product_productpricelookup modify column items_in_stock numeric(18,6);
alter table product_productpricelookup modify column quantity numeric(18,6);
alter table shop_cartitem modify column quantity numeric(18,6);
alter table shop_orderitem modify column quantity numeric(18,6);
alter table supplier_rawitem modify column inventory numeric(18,6);
alter table tieredpricing_tieredprice modify column quantity numeric(18,6);
alter table tieredquantity_quantitytier modify column quantity numeric(18,6);

(Sqlite)

Sorry, you'll need to dump your data, drop the tables, run syncdb, and reload your data. Sqlite doesn't support datatype changes, unfortunately.

Payment Refactor

In [1973] we committed a change to the payment handling system which allows for smooth handling of separate authorization/capture events.

Run syncdb, and then the SQL below.

(Same for Mysql, PostgreSQL, and Sqlite)

update shop_order set status='New' where status='Pending';

alter table shop_orderpayment add column details varchar(255) null;
alter table shop_orderpayment add column reason_code varchar(255) null;

Optional billing data

In [1981] more granular selection of mandatory billing data was introduced. Now it's possible to choose fields which have to be filled on checkout.

If you have been using ''Billing data optional'' in ''Shop'' section, use ''Required billing data'' now. The equivalent of checked ''Billing data optional'' is a selection of the following fields:

  • email
  • first_name
  • last_name
  • country

Tax processor files renamed

In [2007], renamed 'tax.py' to 'processor.py' to avoid naming conflicts in the modules. This allows the modules to import 'tax.utils' for example, without colliding with the module-level tax file. Make sure to remove tax.pyc in all modules after updating, or you'll get an import error.

Expand slug max length

In [2014] expanded the max_length of slugs to 255 characters so it matches product naming conventions.

SQL for altering Postgres

ALTER TABLE product_product ALTER COLUMN slug TYPE varchar(255);
ALTER TABLE product_productpricelookup ALTER COLUMN productslug TYPE varchar(255);

SSL 2.0 Support

In [2017], we added a transparent upgrade to SSL support for payment processors. This requires that you install the SSL module backport from http://pypi.python.org/pypi/ssl/ if you are using a version of Python less than 2.6.

Added !NullBooleanField

In [2019] we incorporated the new NullBooleanField. You need to be synched up to django trunk > changeset 10456

Increased Store Phone Field Length

In [2012] increased the maximum length of the store configuration phone field to 30 from 12.

(PostgreSQL 8)

ALTER TABLE shop_config ALTER COLUMN phone varchar(30);

(PostgreSQL 8.3.5)

ALTER TABLE shop_config ALTER COLUMN phone TYPE varchar(30);

(Mysql)

ALTER TABLE shop_config MODIFY COLUMN phone varchar(30);

Increased size of transaction_id field

in [2045] increased the size of the transaction_id field to support Amazon payments and potentially other ones.

(Mysql)

ALTER TABLE shop_orderpayment MODIFY COLUMN transaction_id varchar(45)

(PostgreSQL 8)

ALTER TABLE shop_orderpayment ALTER COLUMN transaction_id varchar(45);

(PostgreSQL 8.3.5)

ALTER TABLE shop_orderpayment ALTER COLUMN transaction_id TYPE varchar(45);

Discount Changes

In Mercurial commit [1052]:

Discount objects now enforce limited uses if entered. They also have a new feature "Least Expensive Shipping Is Free", which will inspect the shipping choices and only offer the least expensive on the shipping page.

100% discounts are now possible.

Updated discounts to use the same method of percentage entry that the rest of the site uses. That is, you enter "50" for 50%, not 0.5.

Template Changes

We have moved the discount code entry from the pay/ship page to the first page of checkout. If you have overridden 'shop/checkout/base_pay_ship.html' or 'shop/checkout/form.html', you will need to move the discount form section to 'form.html'.

Also, if you've overridden 'base_pay_ship.html', you need to look at the default template to see how the tests have changed for hidden shipping. There are now three possible states: hidden, show immutable description, and select shipping option.

In the first two cases, there is no "form.shipping.field.choices", so if you try to use the template tag "form.shipping.field.choices|length_is:1" you will get an error. Instead, you need to test first for form.shipping_hidden. If that is false, then you can test for form.shipping_description. If there is a value for shipping_description, that indicates that the shipping is immutable, and that you should show the shipping description to the user.

If that description is confusing, simply look at base_pay_ship.html, and it should be much more obvious what you need to do.

SQL Updates

IMPORTANT NOTE

We cannot provide sql to do this automatically. There is a new field, "allValid" for discounts. This indicates that the discount is valid for all discountable products. In the past this was assumed to be true if no valud products were selected. To make things explicit, and to increase query speed, this is now a field. If you have Discounts with no products selected, which are intended to be valid for all products, then you need to go into the admin and manually set 'allValid' to True.

PostgreSQL
alter table product_discount alter column "amount" numeric(8,2);
alter table product_discount alter column "percentage" numeric(5,2);
alter table product_discount alter column "minOrder" numeric(8,2);
alter table product_discount add column "shipping" varchar(10) NULL;
alter table product_discount add column "allValid" boolean NOT NULL default FALSE;
update product_discount set shipping='APPLY' where "includeShipping" = TRUE;
update product_discount set shipping='FREE' where "freeShipping" = TRUE;
alter table product_discount drop column "freeShipping";
alter table product_discount drop column "includeShipping";
update product_discount set percentage = percentaget * 100 where percentage <= 1;
PostgreSQL 8.3.5
alter table product_discount alter column "amount" type numeric(8,2);
alter table product_discount alter column "percentage" type numeric(5,2);
alter table product_discount alter column "minOrder" type numeric(8,2);
alter table product_discount add column "shipping" varchar(10) NULL;
alter table product_discount add column "allValid" boolean NOT NULL default FALSE;
update product_discount set shipping='APPLY' where "includeShipping" = TRUE;
update product_discount set shipping='FREE' where "freeShipping" = TRUE;
alter table product_discount drop column "freeShipping";
alter table product_discount drop column "includeShipping";
update product_discount set percentage = percentage * 100 where percentage <= 1;
MySQL
alter table product_discount modify column amount numeric(8,2);
alter table product_discount modify column percentage numeric(5,2);
alter table product_discount modify column minOrder numeric(8,2);
alter table product_discount add column shipping varchar(10) NULL;
alter table product_discount add column allValid boolean NOT NULL default 0;
update product_discount set shipping='APPLY' where includeShipping = 1;
update product_discount set shipping='FREE' where freeShipping = 1;
alter table product_discount drop column freeShipping;
alter table product_discount drop column includeShipping;
update product_discount set percentage = percentage * 100 where percentage <= 1;
Sqlite
alter table product_discount add column shipping varchar(10) NULL;
alter table product_discount add column allValid boolean NOT NULL default False;
update product_discount set shipping='APPLY' where includeShipping = 1;
update product_discount set shipping='FREE' where freeShipping = 1;
update product_discount set percentage = percentage * 100 where percentage <= 1;

Giftcertificate Message Field Length

In d1ee9281fcdd , modified the giftcertificate message field to be a 255 character field instead of a text field.

Contact Changes

In Mercurial commit [1089] 1617304e0568 on Aug 06, 2009:

Changed various Contact objects to use database lookup fields instead of hard-coded values. This allows us to add new types of interactions, organizations, and roles.

SQL Updates

Make sure to make these changes, and then run syncdb.

PostgreSQL
alter table contact_contact add column "role_id" varchar(30) NULL;
alter table contact_organization add column "role_id" varchar(30) NULL;
alter table contact_organization add column "type_id" varchar(30) NULL;
alter table contact_interaction add column "type_id" varchar(30) NULL;
update contact_contact set role_id=role;
update contact_organization set role_id=role;
update contact_organization set type_id=type;
update contact_interaction set type_id=type;
alter table contact_contact drop column "role";
alter table contact_organization drop column "role";
alter table contact_organization drop column "type";
alter table contact_interaction drop column "type";
MySQL
alter table contact_contact add column role_id varchar(30);
alter table contact_organization add column role_id varchar(30);
alter table contact_organization add column type_id varchar(30);
alter table contact_interaction add column type_id varchar(30);
update contact_contact set role_id=role;
update contact_organization set role_id=role;
update contact_organization set type_id=type;
update contact_interaction set type_id=type;
alter table contact_contact drop column role;
alter table contact_organization drop column role;
alter table contact_organization drop column type;
alter table contact_interaction drop column type;
Sqlite
alter table contact_contact add column role_id varchar(30);
alter table contact_organization add column role_id varchar(30);
alter table contact_organization add column type_id varchar(30);
alter table contact_interaction add column type_id varchar(30);
update contact_contact set role_id=role;
update contact_organization set role_id=role;
update contact_organization set type_id=type;
update contact_interaction set type_id=type;

After running syncdb, when the new models have been created and fixtures have been loaded, you may enforce foreign key integrity in the database:

PostgreSQL
ALTER TABLE contact_contact ADD CONSTRAINT contact_contact_role_id_fkey FOREIGN KEY (role_id) REFERENCES contact_contactrole(key);
ALTER TABLE contact_organization ADD CONSTRAINT contact_organization_role_id_fkey FOREIGN KEY (role_id) REFERENCES contact_contactorganizationrole(key);
ALTER TABLE contact_organization ADD CONSTRAINT contact_organization_type_id_fkey FOREIGN KEY (type_id) REFERENCES contact_contactorganization(key);
ALTER TABLE contact_interaction ADD CONSTRAINT contact_interaction_type_id_fkey FOREIGN KEY (type_id) REFERENCES contact_contactinteractiontype(key);

Active Categories

In 523b0d312d64 added capability to enable and disable categories. A new is_active column was added to the product category table.

Postgresql

alter table product_category add column "is_active" boolean not null default true;
alter table product_category alter "is_active" drop default;

Mysql

alter table product_category add column is_active boolean not null;

Sqlite

alter table product_category add column "is_active" boolean not null;

Updated