urls.py 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import django
  2. from django.conf.urls import url
  3. try:
  4. from django.views.i18n import JavaScriptCatalog
  5. javascript_catalog = JavaScriptCatalog.as_view()
  6. except ImportError: # Django < 2.0
  7. from django.views.i18n import javascript_catalog
  8. from jet.dashboard import dashboard
  9. from jet.dashboard.views import update_dashboard_modules_view, add_user_dashboard_module_view, \
  10. update_dashboard_module_collapse_view, remove_dashboard_module_view, UpdateDashboardModuleView, \
  11. load_dashboard_module_view, reset_dashboard_view
  12. app_name = 'dashboard'
  13. urlpatterns = [
  14. url(
  15. r'^module/(?P<pk>\d+)/$',
  16. UpdateDashboardModuleView.as_view(),
  17. name='update_module'
  18. ),
  19. url(
  20. r'^update_dashboard_modules/$',
  21. update_dashboard_modules_view,
  22. name='update_dashboard_modules'
  23. ),
  24. url(
  25. r'^add_user_dashboard_module/$',
  26. add_user_dashboard_module_view,
  27. name='add_user_dashboard_module'
  28. ),
  29. url(
  30. r'^update_dashboard_module_collapse/$',
  31. update_dashboard_module_collapse_view,
  32. name='update_dashboard_module_collapse'
  33. ),
  34. url(
  35. r'^remove_dashboard_module/$',
  36. remove_dashboard_module_view,
  37. name='remove_dashboard_module'
  38. ),
  39. url(
  40. r'^load_dashboard_module/(?P<pk>\d+)/$',
  41. load_dashboard_module_view,
  42. name='load_dashboard_module'
  43. ),
  44. url(
  45. r'^reset_dashboard/$',
  46. reset_dashboard_view,
  47. name='reset_dashboard'
  48. ),
  49. url(
  50. r'^jsi18n/$',
  51. javascript_catalog,
  52. {'packages': 'jet'},
  53. name='jsi18n'
  54. ),
  55. ]
  56. urlpatterns += dashboard.urls.get_urls()
  57. if django.VERSION[:2] < (1, 8):
  58. from django.conf.urls import patterns
  59. urlpatterns = patterns('', *urlpatterns)