Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

app.py 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. from django.conf.urls.defaults import patterns, url, include
  2. from django.contrib.auth import views as auth_views
  3. from oscar.core.application import Application
  4. from oscar.apps.catalogue.app import application as catalogue_app
  5. from oscar.apps.customer.app import application as customer_app
  6. from oscar.apps.basket.app import application as basket_app
  7. from oscar.apps.checkout.app import application as checkout_app
  8. from oscar.apps.promotions.app import application as promotions_app
  9. from oscar.apps.search.app import application as search_app
  10. from oscar.apps.offer.app import application as offer_app
  11. from oscar.apps.dashboard.app import application as dashboard_app
  12. class Shop(Application):
  13. name = None
  14. catalogue_app = catalogue_app
  15. customer_app = customer_app
  16. basket_app = basket_app
  17. checkout_app = checkout_app
  18. promotions_app = promotions_app
  19. search_app = search_app
  20. dashboard_app = dashboard_app
  21. offer_app = offer_app
  22. def get_urls(self):
  23. urlpatterns = patterns('',
  24. (r'^products/', include(self.catalogue_app.urls)),
  25. (r'^basket/', include(self.basket_app.urls)),
  26. (r'^checkout/', include(self.checkout_app.urls)),
  27. (r'^accounts/', include(self.customer_app.urls)),
  28. (r'^search/', include(self.search_app.urls)),
  29. (r'^dashboard/', include(self.dashboard_app.urls)),
  30. (r'^offers/', include(self.offer_app.urls)),
  31. # Password reset - as we're using Django's default view funtions, we
  32. # can't namespace these urls as that prevents the reverse function
  33. # from working.
  34. url(r'^password-reset/$', auth_views.password_reset, name='password-reset'),
  35. url(r'^password-reset/done/$', auth_views.password_reset_done, name='password-reset-done'),
  36. url(r'^password-reset/confirm/$', auth_views.password_reset_confirm, name='password-reset-confirm'),
  37. url(r'^password-reset/complete/$', auth_views.password_reset_complete, name='password-reset-complete'),
  38. (r'', include(self.promotions_app.urls)),
  39. )
  40. return urlpatterns
  41. # 'shop' kept for legacy projects - 'application' is a better name
  42. shop = application = Shop()