You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

app.py 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. from django.conf.urls import patterns, url, include
  2. from django.contrib.auth import views as auth_views
  3. from django.core.urlresolvers import reverse_lazy
  4. from oscar.core.application import Application
  5. from oscar.apps.catalogue.app import application as catalogue_app
  6. from oscar.apps.customer.app import application as customer_app
  7. from oscar.apps.basket.app import application as basket_app
  8. from oscar.apps.checkout.app import application as checkout_app
  9. from oscar.apps.promotions.app import application as promotions_app
  10. from oscar.apps.search.app import application as search_app
  11. from oscar.apps.offer.app import application as offer_app
  12. from oscar.apps.dashboard.app import application as dashboard_app
  13. from oscar.apps.customer import forms
  14. from oscar.views.decorators import login_forbidden
  15. class Shop(Application):
  16. name = None
  17. catalogue_app = catalogue_app
  18. customer_app = customer_app
  19. basket_app = basket_app
  20. checkout_app = checkout_app
  21. promotions_app = promotions_app
  22. search_app = search_app
  23. dashboard_app = dashboard_app
  24. offer_app = offer_app
  25. def get_urls(self):
  26. urlpatterns = patterns('',
  27. (r'^i18n/', include('django.conf.urls.i18n')),
  28. (r'^catalogue/', include(self.catalogue_app.urls)),
  29. (r'^basket/', include(self.basket_app.urls)),
  30. (r'^checkout/', include(self.checkout_app.urls)),
  31. (r'^accounts/', include(self.customer_app.urls)),
  32. (r'^search/', include(self.search_app.urls)),
  33. (r'^dashboard/', include(self.dashboard_app.urls)),
  34. (r'^offers/', include(self.offer_app.urls)),
  35. # Password reset - as we're using Django's default view funtions,
  36. # we can't namespace these urls as that prevents
  37. # the reverse function from working.
  38. url(r'^password-reset/$',
  39. login_forbidden(auth_views.password_reset),
  40. {'password_reset_form': forms.PasswordResetForm,
  41. 'post_reset_redirect': reverse_lazy('password-reset-done')},
  42. name='password-reset'),
  43. url(r'^password-reset/done/$',
  44. login_forbidden(auth_views.password_reset_done),
  45. name='password-reset-done'),
  46. url(r'^password-reset/confirm/(?P<uidb36>[0-9A-Za-z]{1,13})-(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
  47. login_forbidden(auth_views.password_reset_confirm),
  48. {'post_reset_redirect': reverse_lazy('password-reset-complete')},
  49. name='password-reset-confirm'),
  50. url(r'^password-reset/complete/$',
  51. login_forbidden(auth_views.password_reset_complete),
  52. name='password-reset-complete'),
  53. (r'', include(self.promotions_app.urls)),
  54. )
  55. return urlpatterns
  56. # 'shop' kept for legacy projects - 'application' is a better name
  57. shop = application = Shop()