awesto / django-shop

A Django based shop system
http://www.django-shop.org
BSD 3-Clause "New" or "Revised" License
3.19k stars 1.04k forks source link

CMS apphooks for cart and checkout #482

Open rubengrill opened 7 years ago

rubengrill commented 7 years ago

Currently the cart and checkout are implemented via rest ViewSets to handle the server side logic, angular directives on the client side to interact with it and cms plugins to render the cart/checkout forms in a cms page.

Personally, I don't want to use that strategy, because of two reasons:

In a recent project I created an apphook for both the cart and the checkout, they are just FormViews rendering a template where the complete cart/checkout markup is rendered, without a single cms plugin.

With this issue I would like to start a discussion, if django shop should also provide apphooks as an alternative to plugins with angular integration.

Maybe that would not even be too much effort by having apphooks using the existing ViewSets. The ViewSets could be extended to also support rendering templates.

rfleschenberg commented 7 years ago

IMHO we should move the Angular parts out of django-shop into a separate package. Some developers like Angular, some hate it. I'd prefer to be agnostic in regard to frontend frameworks, so that people can use Angular, jQuery, react, something else, or even no client-side scripting at all.

That doesn't mean that we would maintain all of these solutions, of course. We would likely maintain only one default solution (which might happen to be Angular), but as a separate package to ensure that the dependency doesn't leak into the main django-shop package.

The problem with all of this of course is that somebody has to do it, while providing a good upgrade path for existing deployments :) But yes, I am definitely interested in seeing those apphooks!

In the long run, I would even be interested in having a django-shop package without the dependency on django-cms. While most shops want a CMS, some shops don't. And some shops may want Mezzanine, Wagtail or whatever. But that is probably a topic for another issue.

jrief commented 7 years ago

I fully agree with @rfleschenberg . The reason AngularJS is tight into django-SHOP is mainly, automatic client-side form validation.

Therefore, one might run django-SHOP even without django-CMS and hence without Cascade. I tried to use loose coupling, and that's also the reason why I keep dependencies in separate packages, even if I am the author of them: djangocms-cascade, django-angular, angular-bootstrap-plus (pure Javascript), djangocms-bootstrap3 and django-sass-processor. Authors of other frameworks tend to put everything together, making them very opinionated towards a certain technology stack. This is something I really want to avoid.

However, my main focus was on features, flexibility and extensibility. Therefore I did not invest a lot of time in trying how to run django-SHOP without, say AngularJS or django-CMS or Cascade plugins, even if with some effort, this should be possible.

If someone wants to run django-SHOP without CMS, one major external library would be a flexible category system. If possible, this should use the deferred model framework.

@rubengrill could you please send me your e-main address?