Open helper08 opened 3 years ago
Currently, there is a lot of redundancy in our urlpatterns as we repeat a lot of prefixes for url groupings. This could be made cleaner by using include(...)
For example, for the Secretary urls:
url(r'^secretary/$', views.secretary, name="secretary"), url(r'^secretary/positions/$', views.secretary_positions, name="secretary_positions"), url(r'^secretary/positions/add/$', views.secretary_position_add, name="secretary_position_add"), url(r'^secretary/position/(?P<pk>\d+)/edit/$', views.PositionEdit.as_view(), name="secretary_position_edit"), url(r'^secretary/position/(?P<pk>\d+)/delete/$', views.PositionDelete.as_view(), name="secretary_position_delete"), url(r'^secretary/attendance/$', views.secretary_attendance, name="secretary_attendance"), url(r'^secretary/attendance/attendance.csv/$', views.secretary_attendance_csv, name="secretary_attendance_csv"), url(r'^secretary/brother/list/$', views.secretary_brother_list, name="secretary_brother_list"), url(r'^secretary/agenda/$', views.secretary_agenda, name="secretary_agenda"),
could instead become:
url(r'^secretary/', include(secretary_patterns)) secretary patterns = [ url(r'^$', views.secretary, name="secretary"), url(r'^positions/$', views.secretary_positions, name="secretary_positions"), url(r'^positions/add/$', views.secretary_position_add, name="secretary_position_add"), url(r'^position/(?P<pk>\d+)/edit/$', views.PositionEdit.as_view(), name="secretary_position_edit"), url(r'^position/(?P<pk>\d+)/delete/$', views.PositionDelete.as_view(), name="secretary_position_delete"), url(r'^attendance/$', views.secretary_attendance, name="secretary_attendance"), url(r'^attendance/attendance.csv/$', views.secretary_attendance_csv, name="secretary_attendance_csv"), url(r'^brother/list/$', views.secretary_brother_list, name="secretary_brother_list"), url(r'^agenda/$', views.secretary_agenda, name="secretary_agenda"), ]
More documentation for this can be found here: https://docs.djangoproject.com/en/3.1/topics/http/urls/#including-other-urlconfs
Currently, there is a lot of redundancy in our urlpatterns as we repeat a lot of prefixes for url groupings. This could be made cleaner by using include(...)
For example, for the Secretary urls:
could instead become:
More documentation for this can be found here: https://docs.djangoproject.com/en/3.1/topics/http/urls/#including-other-urlconfs