Plata 1.2 release notes (upcoming)

Welcome to Plata 1.2!

Backwards-incompatible changes

South migrations removal

Plata does not include database migrations for South (anymore). The reason for that is that Django (and by extension, South) does not support the concept of lazy foreign keys. Because you’re free to choose any model as product for Plata (configurable using PLATA_SHOP_PRODUCT) we do not know beforehand, how the database constraints for the order item product foreign key should look beforehand.

Upgrade instructions and further informations are available in Database migrations.

Cart handling changes

Products do not have to be unique in a cart or an order anymore. This change allows more flexibility in product models, for example the implementation of configurable products where an article (i.e. a copmuter) can be bought with different combinations of upgrades.

Additionally, if a product is deleted from the inventory, the cart view removes the order item and notifies the user. The behavior for orders in or after the checkout process has not been changed.

Custom User model support

The plata.shop migrations will no longer apply if you’re using a custom user model. In this case, use the SOUTH_MIGRATION_MODULES settings to specify the location of your custom migrations.

Suggestion: before creating your initial plata.shop migration, comment out the entire OrderItem model from plata.shop.models and run manage.py schemamigration shop --initial so that you have an initial migration which doesn’t depend on your Product model. Then create your migration for your Product model’s app, which is likely dependent upon plata.shop models such as TaxClass, so you can add depends_on = (('shop', '0001_initial'),) to that migration. Finally, reinstate the OrderItem model definition, and run manage.py schemamigration shop --auto, optionally adding another depends_on definition to ensure that your Product model is created first.

TODO: update tests to handle custom User model

Django compatibility

Plata is developed and tested with Django 1.4 and the upcoming 1.5.

Notable features

  • The shop view now comes with two additional methods, redirect and reverse_url which can be used to customize the URL reversal process which is especially useful with namespaced URLs.
  • The Django model used for stock tracking can be changed using the new PLATA_STOCK_TRACKING_MODEL setting.
  • The product foreign key on stock transactions now has on_delete=SET_NULL set as well.
  • If the method Product.handle_stock_transaction exists, it is called when saving stock transactions providing the opportunity for filling in additional fields.
  • Tax classes no longer have reverse foreign keys to prices. That means that having more than one price model in a project is now fully supported.
  • Whether prices should be shown with tax included or not can be decided per-order now.

Bugfixes

  • The plata context processor does not crash anymore when there is no session.
  • The shop does not crash anymore during checkout if email sending fails for some reason.