Problem: Currently models Cart, CartItem, Order and OrderItem are part of django-shop.
If someone wants to use its own model, he may derive from CartBase and/or OrderBase and add these model using the
django config settings SHOP_ORDER_MODEL and/or SHOP_CART_MODEL.
While this works well, it poses some problems: Internally these models are loaded using some magic functionality,
such as the function load_class. This makes the code hard to understand for syntax analysers, such as pep8.py.
It also makes it hard for humans, since this magicness requires to read the code twice. Additionally I often get confused,
when I have to look at the Cart or Order model internals, because I often don't find the code where I'd expect it.
Proposal: Below the main module shop, add two modules named cartmodel and ordermodel. These modules contain
these models then would have to be referenced in settingy.py by adding 'shop.cartmodel' and 'shop.ordermodel'
to INSTALLED_APPS. Developers with alternative models would add theirs to INSTALLED_APPS,. This eliminates the need
for SHOP_ORDER_MODEL and/or SHOP_CART_MODEL.
Advantages: This is more consistent with other known Django-applications. For instance, shop.addressmodel is already loaded this way.
Django-CMS loads its plugins this way. pep8.py would work how it should. The admin interface for Order and Cart would be
added to this module, keeping the code for these modules self-contained. South migration files would be kept in these directories,
keeping the main code tree cleaner. Unit tests for third party apps, would be simpler to write.
What do you think about? Please contact me on IRC to further discuss (or dismiss) this idea.
- Jacob