Hi
I have been very impressed by Wagtail CMS and its' 'developer first' approach. Using it feels like both a fully fledged, mature CMS and also a totally non-intrusive app which allows me to just code almost like I am using pure Django when I need to 'break out'.
Thumbs up to the developers.
As such, I decided to build my e-commerce website using Wagtail. I wasn't completely convinced by the existing Django e-commerce options out there and since my needs are quite 'light weight' (I am a low-volume vendor making & selling audio electronics stuff as hobby outside my day job) I decided to roll my own. This basically amounted to me implementing the following (so far):
- a 'products' app which has the products models. This is the only truly 'wagtail' app, with models which inherit from the wagtail Page
- a 'basket' app, which offers a regular django model for basket items. I wanted my 'basket' display to be a dynamic modal popup, so I wrote it as essentially a rest api and used react.js on the front end. Since wagtail expects you to take full control of your front end, this was more than easy to integrate.
- a 'checkout' app, which goes hand in hand with the basket app and essentially just provides an interface to the backend payment gateway
- a 'shipping' app. Just a simple model to set different shipping rates
- an 'orders' app. Obviously, this keeps track of orders. Despite writing as a regular django model, I was able to use the excellent ModelAdmin to have a fully fledged 'Orders' interface on the Wagtail admin.
A very early, alpha version of the site I am building is here:
There is still much work to do and I have a couple of questions.
Specifically I would like to override the template used for the Orders in the wagtail ModelAdmin. I think I gathered that this is possible, but there are a couple of areas I am not sure about:
- What context is passed in to the template (or do I need to write my own view and provide the context)?
- The orders model (a standard django model) has some foreign key relationships - is it possible to display these, or will I need to provide the context (as above)?
- Can I add custom javascript somehow? I.e. I would like to include a 'fufill' button for each order which will edit the order model (to 'fufill it')
I will happily open source the shop code if anyone thinks it will be interesting. I have written it to allow you to provide your own product model(s), payment backends and other customisations. I will also happily open source the react apps for the shopping basket and checkout if anyone would find it useful.