Have you considered code from other projects with a similar approach? Not sure if this method meets your needs, but pay attention to the django-shop code.
This structure provides the basic logic, allowing you to customize the logic if necessary.
customize through models
e.g. see productmodel.py
#==============================================================================
configure via logic / url
for example, see the simplevariation-plugin store. It extends the logic basket, so it connects via urlpattern:
(r'^shop/cart/', include(simplevariations_urls)), (r'^shop/', include(shop_urls)),
and expands views: ...
from shop.views.cart import CartDetails class SimplevariationCartDetails(CartDetails): """Cart view that answers GET and POSTS request.""" ...
The structure provides several points for connection, the simple plug-in mentioned above provides a cart modifier:
SHOP_CART_MODIFIERS = [ ... 'shop_simplevariations.cart_modifier.ProductOptionsModifier', ... ]
I am worried that this explanation is not very clear, it is difficult to briefly generalize this concept. But look at the django-shop project and some of its extensions: ecosystem
source share