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.6KB

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