You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create an app, add a model with a OneToOne field to Topic, and the extra fields you need, fork Spirit and add the form to the relevant views and templates.
Extending the Spirit model in-place (like just adding fields willy nilly) is not a good idea. It'll create conflicts with future migrations.
What django-oscar and django-machina provide is not a plugin system; they let you extend/override some model or form, but their way is not composable. How do multiple apps/plugin extend the same model?.
Say there is a "product" in my website that a Topic needs to promote. What you are suggesting is that
I create a TopicThatRecommendsProduct model that is one to one to Topic, which is ok.
Since the sprit renderer does not know Product, I will need to fork spirit to add views and forms to mention product, so the fork will actually import product from my models.
Compared to the django-oscar approach, I think the biggest problem is that I will have to maintain Product in both my website and the spirit fork. Can django-hook be used to avoid a fork?
Step 2 is to create a form for your product model. Step 3 is to fork Spirit and add the form to whatever view and templates are needed to display the form. You'll need to maintain (i.e: solve git conflicts) the affected views and templates.
Can django-hook be used to avoid a fork?
Yes, but it was never integrated into Spirit, so no...
Activity
BoPeng commentedon Jan 2, 2021
#96 (comment) seems to be closest existing discussion that I can find.
BoPeng commentedon Jan 2, 2021
So spirit did not allow adding additional fields to the
Topicclass, like whatdjango-oscaranddjango-machinaprovide. Is this still the case now?nitely commentedon Jan 2, 2021
Create an app, add a model with a OneToOne field to Topic, and the extra fields you need, fork Spirit and add the form to the relevant views and templates.
Extending the Spirit model in-place (like just adding fields willy nilly) is not a good idea. It'll create conflicts with future migrations.
What django-oscar and django-machina provide is not a plugin system; they let you extend/override some model or form, but their way is not composable. How do multiple apps/plugin extend the same model?.
BoPeng commentedon Jan 2, 2021
Say there is a "product" in my website that a
Topicneeds to promote. What you are suggesting is thatTopicThatRecommendsProductmodel that is one to one toTopic, which is ok.spritrenderer does not knowProduct, I will need to forkspiritto add views and forms to mentionproduct, so the fork will actually importproductfrom my models.Compared to the
django-oscarapproach, I think the biggest problem is that I will have to maintainProductin both my website and thespiritfork. Candjango-hookbe used to avoid a fork?nitely commentedon Jan 2, 2021
Step 2 is to create a form for your product model. Step 3 is to fork Spirit and add the form to whatever view and templates are needed to display the form. You'll need to maintain (i.e: solve git conflicts) the affected views and templates.
Yes, but it was never integrated into Spirit, so no...