To extend templates: Create a template in your project under the same
path as the Cartridge template. For example, if you want to provide your
own template for Products, create a template in
your_app/templates/shop/product.html. Here's an explanation of Django's
template loading:
https://docs.djangoproject.com/en/1.11/ref/templates/api/#django.template.loaders.app_directories.Loader
Here are all the Cartridge templates you can override in your own
project:
https://github.com/stephenmcd/cartridge/tree/master/cartridge/shop/templates
To extend views: You can create your own views and register them in the
same URL pattern as the view you want to override. If you want to
override the view that renders the checkout page, you can register your
own view at the /shop/checkout path. Make sure your overriden views are
registered before the Cartridge urlpatterns. For example
url("^shop/checkout/", my_views.my_custom_checkout, name="shop_checkout")
Here's Cartridge's url config which lists all urls managed by Cartridge:
https://github.com/stephenmcd/cartridge/blob/master/cartridge/shop/urls.py
To override models you can use Mezzanine's field injection, documented
here: http://mezzanine.jupo.org/docs/model-customization.html. Notice
this is useful only to add new fields to a model, not to remove or alter
existing fields. For that you might need to maintain your own fork.
Finally, remember Cartridge comes with a bunch of settings you can
customize to modify it's behavior, you can review them all here:
http://cartridge.jupo.org/configuration.html
On 2017-09-23 5:19 PM, jenia mtl wrote:
Hello.
I want to change cartridge a little. Change the templates, change the
views and do on.
I did it by changing the code of the app itself. But I do not think
it's the best idea for obvious reason (when the app will be upgrades,
I'll be hard to merge my changes for example).
How do I extend Cartridge? Is there a mechanism to extend, override
and so on Cartridge?
Thanks
--
You received this message because you are subscribed to the Google
Groups "Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Mezzanine
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.