|
1 | 1 | from django.views import i18n |
2 | | -from django.urls import include, path |
| 2 | +from django.urls import include, path, re_path |
| 3 | +from django.urls import path |
3 | 4 | from django.contrib import admin |
4 | 5 | from django.contrib.auth.views import LoginView |
5 | 6 |
|
|
11 | 12 | import mittab.apps.tab.pairing_views as pairing_views |
12 | 13 | import mittab.apps.tab.outround_pairing_views as outround_pairing_views |
13 | 14 |
|
| 15 | + |
14 | 16 | admin.autodiscover() |
15 | 17 |
|
16 | 18 | urlpatterns = [ |
17 | 19 | path("admin/logout/", views.tab_logout, name="admin_logout"), |
18 | 20 | path("accounts/logout/", views.tab_logout, name="logout"), |
19 | | - path("admin/", admin.site.urls, name="admin"), |
| 21 | + re_path(r"^admin/", admin.site.urls, name="admin"), |
20 | 22 | path("dynamic-media/jsi18n/", i18n.JavaScriptCatalog.as_view(), name="js18"), |
21 | 23 | path("", views.index, name="index"), |
22 | | - path("403/", views.render_403, name="403"), |
23 | | - path("404/", views.render_404, name="404"), |
24 | | - path("500/", views.render_500, name="500"), |
25 | | - |
| 24 | + re_path(r"^403/", views.render_403, name="403"), |
| 25 | + re_path(r"^404/", views.render_404, name="404"), |
| 26 | + re_path(r"^500/", views.render_500, name="500"), |
| 27 | + |
26 | 28 | # Account related |
27 | | - path("accounts/login/", LoginView.as_view(template_name="registration/login.html"), name="tab_login"), |
28 | | - |
| 29 | + path("accounts/login/", |
| 30 | + LoginView.as_view(template_name="registration/login.html"), |
| 31 | + name="tab_login"), |
| 32 | + |
29 | 33 | # Judge related |
30 | | - path("judges/", judge_views.public_view_judges, name="public_judges"), |
31 | | - path("judge/<int:judge_id>/", judge_views.view_judge, name="view_judge"), |
32 | | - path("judge/<int:judge_id>/scratches/add/<int:scratch_id>/", judge_views.add_scratches, name="add_scratches"), |
33 | | - path("judge/<int:judge_id>/scratches/view/", judge_views.view_scratches, name="view_scratches"), |
34 | | - path("judge/<int:judge_id>/check_ins/round/<int:round_id>/", judge_views.judge_check_in, name="judge_check_in"), |
| 34 | + re_path(r"^judges/", judge_views.public_view_judges, name="public_judges"), |
| 35 | + re_path(r"^judge/(\d+)/$", judge_views.view_judge, name="view_judge"), |
| 36 | + re_path(r"^judge/(\d+)/scratches/add/(\d+)/", |
| 37 | + judge_views.add_scratches, |
| 38 | + name="add_scratches"), |
| 39 | + re_path(r"^judge/(\d+)/scratches/view/", |
| 40 | + judge_views.view_scratches, |
| 41 | + name="view_scratches"), |
| 42 | + re_path(r"^judge/(\d+)/check_ins/round/(\d+)/$", |
| 43 | + judge_views.judge_check_in, |
| 44 | + name="judge_check_in"), |
35 | 45 | path("view_judges/", judge_views.view_judges, name="view_judges"), |
36 | 46 | path("enter_judge/", judge_views.enter_judge, name="enter_judge"), |
37 | 47 | path("batch_checkin/", judge_views.batch_checkin, name="batch_checkin"), |
38 | | - |
| 48 | + |
39 | 49 | # School related |
40 | | - path("school/<int:school_id>/", views.view_school, name="view_school"), |
41 | | - path("school/<int:school_id>/delete/", views.delete_school, name="delete_school"), |
| 50 | + re_path(r"^school/(\d+)/$", views.view_school, name="view_school"), |
| 51 | + re_path(r"^school/(\d+)/delete/$", views.delete_school, name="delete_school"), |
42 | 52 | path("view_schools/", views.view_schools, name="view_schools"), |
43 | 53 | path("enter_school/", views.enter_school, name="enter_school"), |
44 | | - |
| 54 | + |
45 | 55 | # Room related |
46 | | - path("room/<int:room_id>/", views.view_room, name="view_room"), |
| 56 | + re_path(r"^room/(\d+)/$", views.view_room, name="view_room"), |
47 | 57 | path("view_rooms/", views.view_rooms, name="view_rooms"), |
48 | 58 | path("enter_room/", views.enter_room, name="enter_room"), |
49 | | - path("room/<int:room_id>/check_ins/round/<int:round_id>/", views.room_check_in, name="room_check_in"), |
| 59 | + re_path(r"^room/(\d+)/check_ins/round/(\d+)/$", |
| 60 | + views.room_check_in, |
| 61 | + name="room_check_in"), |
50 | 62 | path("batch_room_checkin/", views.batch_checkin, name="batch_room_checkin"), |
51 | | - |
| 63 | + |
| 64 | + |
52 | 65 | # Scratch related |
53 | | - path("judge/<int:judge_id>/scratches/delete/<int:scratch_id>/", views.delete_scratch, name="delete_scratch_judge"), |
54 | | - path("team/<int:team_id>/scratches/delete/<int:scratch_id>/", views.delete_scratch, name="delete_scratch_team"), |
55 | | - path("scratches/view/", views.view_scratches, name="view_scratches"), |
56 | | - path("enter_scratch/", views.add_scratch, name="add_scratch"), |
57 | | - |
| 66 | + re_path(r"^judge/(\d+)/scratches/delete/(\d+)/", |
| 67 | + views.delete_scratch, |
| 68 | + name="delete_scratch_judge"), |
| 69 | + re_path(r"^team/(\d+)/scratches/delete/(\d+)/", |
| 70 | + views.delete_scratch, |
| 71 | + name="delete_scratch_team"), |
| 72 | + re_path(r"^scratches/view/", views.view_scratches, name="view_scratches"), |
| 73 | + re_path(r"^enter_scratch/", views.add_scratch, name="add_scratch"), |
| 74 | + |
58 | 75 | # Team related |
59 | | - path("teams/", team_views.public_view_teams, name="public_teams"), |
60 | | - path("team/<int:team_id>/", team_views.view_team, name="view_team"), |
61 | | - path("team/<int:team_id>/scratches/add/<int:scratch_id>/", team_views.add_scratches, name="add_scratches"), |
62 | | - path("team/<int:team_id>/scratches/view/", team_views.view_scratches, name="view_scratches_team"), |
| 76 | + re_path(r"^teams/", team_views.public_view_teams, name="public_teams"), |
| 77 | + re_path(r"^team/(\d+)/$", team_views.view_team, name="view_team"), |
| 78 | + re_path(r"^team/(\d+)/scratches/add/(\d+)/", |
| 79 | + team_views.add_scratches, |
| 80 | + name="add_scratches"), |
| 81 | + re_path(r"^team/(\d+)/scratches/view/", |
| 82 | + team_views.view_scratches, |
| 83 | + name="view_scratches_team"), |
63 | 84 | path("view_teams/", team_views.view_teams, name="view_teams"), |
64 | 85 | path("enter_team/", team_views.enter_team, name="enter_team"), |
65 | 86 | path("all_tab_cards/", team_views.all_tab_cards, name="all_tab_cards"), |
66 | | - path("team/card/<int:team_id>/", team_views.tab_card, name="tab_card"), |
67 | | - path("team/card/<int:team_id>/pretty/", team_views.pretty_tab_card, name="pretty_tab_card"), |
68 | | - path("team/ranking/", team_views.rank_teams_ajax, name="rank_teams_ajax"), |
| 87 | + re_path(r"^team/card/(\d+)/$", team_views.tab_card, name="tab_card"), |
| 88 | + re_path(r"^team/card/(\d+)/pretty/$", |
| 89 | + team_views.pretty_tab_card, |
| 90 | + name="pretty_tab_card"), |
| 91 | + path("export_tournament/", views.export_tournament, name="export_tournament"), |
| 92 | + re_path(r"^archive/download/(?P<format>json|csv|xml)/$", views.export_tournament, name="export_tournament"), |
| 93 | + path("team/ranking/", team_views.rank_teams_ajax, |
| 94 | + name="rank_teams_ajax"), |
69 | 95 | path("team/rank/", team_views.rank_teams, name="rank_teams"), |
70 | | - |
| 96 | + |
71 | 97 | # Debater related |
72 | | - path("debater/<int:debater_id>/", debater_views.view_debater, name="view_debater"), |
73 | | - path("view_debaters/", debater_views.view_debaters, name="view_debaters"), |
74 | | - path("enter_debater/", debater_views.enter_debater, name="enter_debater"), |
75 | | - path("debater/ranking/", debater_views.rank_debaters_ajax, name="rank_debaters_ajax"), |
| 98 | + re_path(r"^debater/(\d+)/$", debater_views.view_debater, name="view_debater"), |
| 99 | + path("view_debaters/", debater_views.view_debaters, |
| 100 | + name="view_debaters"), |
| 101 | + path("enter_debater/", debater_views.enter_debater, |
| 102 | + name="enter_debater"), |
| 103 | + path("debater/ranking/", |
| 104 | + debater_views.rank_debaters_ajax, |
| 105 | + name="rank_debaters_ajax"), |
76 | 106 | path("debater/rank/", debater_views.rank_debaters, name="rank_debaters"), |
77 | | - |
78 | | - # Import Data |
| 107 | + |
| 108 | + # Pairing related |
| 109 | + path("pairings/status/", pairing_views.view_status, name="view_status"), |
| 110 | + path("pairings/view_rounds/", |
| 111 | + pairing_views.view_rounds, |
| 112 | + name="view_rounds"), |
| 113 | + re_path(r"^round/(\d+)/$", pairing_views.view_round, name="view_round"), |
| 114 | + re_path(r"^round/(\d+)/stats/$", pairing_views.team_stats, name="team_stats"), |
| 115 | + re_path(r"^round/(\d+)/result/$", |
| 116 | + pairing_views.enter_result, |
| 117 | + name="enter_result"), |
| 118 | + re_path(r"^round/(\d+)/result/(\d+)/$", |
| 119 | + pairing_views.enter_multiple_results, |
| 120 | + name="enter_multiple_results"), |
| 121 | + re_path(r"^round/(\d+)/alternative_judges/(\d+)/$", |
| 122 | + pairing_views.alternative_judges, |
| 123 | + name="round_alternative_judges"), |
| 124 | + re_path(r"^round/(\d+)/(\d+)/alternative_teams/(gov|opp)/$", |
| 125 | + pairing_views.alternative_teams, |
| 126 | + name="round_alternative_teams"), |
| 127 | + re_path(r"^round/(\d+)/alternative_judges/$", |
| 128 | + pairing_views.alternative_judges, |
| 129 | + name="alternative_judges"), |
| 130 | + re_path(r"^round/(\d+)/assign_judge/(\d+)/$", |
| 131 | + pairing_views.assign_judge, |
| 132 | + name="assign_judge"), |
| 133 | + re_path(r"^pairings/assign_team/(\d+)/(gov|opp)/(\d+)/$", |
| 134 | + pairing_views.assign_team, |
| 135 | + name="assign_team"), |
| 136 | + re_path(r"^round/(\d+)/assign_judge/(\d+)/(\d+)/$", |
| 137 | + pairing_views.assign_judge, |
| 138 | + name="swap_judge"), |
| 139 | + path("pairing/pair_round/", pairing_views.pair_round, name="pair_round"), |
| 140 | + path("pairing/assign_judges/", |
| 141 | + pairing_views.assign_judges_to_pairing, |
| 142 | + name="assign_judges"), |
| 143 | + path("pairing/confirm_start_tourny/", |
| 144 | + pairing_views.confirm_start_new_tourny, |
| 145 | + name="confirm_start_tourny"), |
| 146 | + path("pairing/start_tourny/", |
| 147 | + pairing_views.start_new_tourny, |
| 148 | + name="start_tourny"), |
| 149 | + path("pairings/pairinglist/", |
| 150 | + pairing_views.pretty_pair, |
| 151 | + name="pretty_pair"), |
| 152 | + path("pairings/missing_ballots/", |
| 153 | + pairing_views.missing_ballots, |
| 154 | + name="missing_ballots"), |
| 155 | + path("pairings/pairinglist/printable/", |
| 156 | + pairing_views.pretty_pair_print, |
| 157 | + name="pretty_pair_print"), |
| 158 | + path("pairing/backup/", |
| 159 | + pairing_views.manual_backup, |
| 160 | + name="manual_backup"), |
| 161 | + path("pairing/release/", |
| 162 | + pairing_views.toggle_pairing_released, |
| 163 | + name="toggle_pairing_released"), |
| 164 | + path("pairing/view_backups/", |
| 165 | + pairing_views.view_backups, |
| 166 | + name="view_backups"), |
| 167 | + path("e_ballots/", pairing_views.e_ballot_search, |
| 168 | + name="e_ballot_search"), |
| 169 | + re_path(r"e_ballots/(\S+)/$", |
| 170 | + pairing_views.enter_e_ballot, |
| 171 | + name="enter_e_ballot"), |
| 172 | + |
| 173 | + # Outround related |
| 174 | + re_path(r"break/", |
| 175 | + outround_pairing_views.break_teams, |
| 176 | + name="break"), |
| 177 | + path("outround_pairing/<int:type_of_round>/<int:num_teams>", |
| 178 | + outround_pairing_views.outround_pairing_view, |
| 179 | + name="outround_pairing_view"), |
| 180 | + path("outround_pairing", |
| 181 | + outround_pairing_views.outround_pairing_view, |
| 182 | + name="outround_pairing_view_default"), |
| 183 | + re_path(r"^outround/(\d+)/alternative_judges/(\d+)/$", |
| 184 | + outround_pairing_views.alternative_judges, |
| 185 | + name="outround_alternative_judges"), |
| 186 | + re_path(r"^outround/(\d+)/(\d+)/alternative_teams/(gov|opp)/$", |
| 187 | + outround_pairing_views.alternative_teams, |
| 188 | + name="outround_alternative_teams"), |
| 189 | + re_path(r"^outround/(\d+)/alternative_judges/$", |
| 190 | + outround_pairing_views.alternative_judges, |
| 191 | + name="outround_alternative_judges"), |
| 192 | + re_path(r"^outround/(\d+)/assign_judge/(\d+)/$", |
| 193 | + outround_pairing_views.assign_judge, |
| 194 | + name="outround_assign_judge"), |
| 195 | + re_path(r"^outround/pairings/assign_team/(\d+)/(gov|opp)/(\d+)/$", |
| 196 | + outround_pairing_views.assign_team, |
| 197 | + name="outround_assign_team"), |
| 198 | + re_path(r"^outround/(\d+)/assign_judge/(\d+)/(\d+)/$", |
| 199 | + outround_pairing_views.assign_judge, |
| 200 | + name="outround_swap_judge"), |
| 201 | + re_path(r"^outround/(\d+)/result/$", |
| 202 | + outround_pairing_views.enter_result, |
| 203 | + name="enter_result"), |
| 204 | + path("outround_pairing/pair/<int:type_of_round>/<int:num_teams>/", |
| 205 | + outround_pairing_views.pair_next_outround, |
| 206 | + name="next_outround"), |
| 207 | + path("outround_pairings/pairinglist/<int:type_of_round>/", |
| 208 | + outround_pairing_views.pretty_pair, |
| 209 | + name="outround_pretty_pair"), |
| 210 | + path("outround_pairings/pairinglist/printable/<int:type_of_round>/", |
| 211 | + outround_pairing_views.pretty_pair_print, |
| 212 | + name="outround_pretty_pair_print"), |
| 213 | + path("outround_pairing/release/<int:num_teams>/<int:type_of_round>/", |
| 214 | + outround_pairing_views.toggle_pairing_released, |
| 215 | + name="toggle_outround_pairing_released"), |
| 216 | + path("outround_result/<int:type_of_round>", |
| 217 | + outround_pairing_views.forum_view, |
| 218 | + name="forum_view"), |
| 219 | + path("outround_choice/<int:outround_id>", |
| 220 | + outround_pairing_views.update_choice, |
| 221 | + name="update_choice"), |
| 222 | + |
| 223 | + # Settings related |
| 224 | + re_path(r"^settings_form", |
| 225 | + views.settings_form, |
| 226 | + name="settings_form"), |
| 227 | + |
| 228 | + # Backups |
| 229 | + re_path(r"^backup/restore/(.+)/$", |
| 230 | + pairing_views.restore_backup, |
| 231 | + name="restore_backup"), |
| 232 | + re_path(r"^backup/download/(.+)/$", |
| 233 | + pairing_views.download_backup, |
| 234 | + name="download_backup"), |
| 235 | + re_path(r"^backup/(.+)/$", pairing_views.view_backup, name="view_backup"), |
| 236 | + path("upload_backup/", pairing_views.upload_backup, |
| 237 | + name="upload_backup"), |
| 238 | + |
| 239 | + # Data Upload |
79 | 240 | path("import_data/", views.upload_data, name="upload_data"), |
80 | | - |
| 241 | + |
| 242 | + |
81 | 243 | # Tournament Archive |
82 | 244 | path("archive/download/", views.generate_archive, name="download_archive"), |
83 | | - |
| 245 | + |
84 | 246 | # Cache related |
85 | | - path("cache_refresh/", views.force_cache_refresh, name="cache_refresh"), |
| 247 | + re_path(r"^cache_refresh", views.force_cache_refresh, name="cache_refresh"), |
86 | 248 | ] |
87 | 249 |
|
88 | 250 | if settings.SILK_ENABLED: |
89 | 251 | urlpatterns += [ |
| 252 | + # Profiler |
90 | 253 | path("silk/", include("silk.urls", namespace="silk")) |
91 | 254 | ] |
92 | 255 |
|
|
0 commit comments