update dependencies and upgrade code for django where needed/possible

This commit is contained in:
Laura Klünder 2022-04-03 16:33:43 +02:00
parent 0f4e699e37
commit 03437a3a40
67 changed files with 331 additions and 207 deletions

View file

@ -1,42 +1,48 @@
from django.conf.urls import url
from django.urls import path, register_converter
from c3nav.site.converters import LocationConverter, CoordinatesConverter, AtPositionConverter, IsEmbedConverter
from c3nav.site.views import (about_view, access_redeem_view, account_view, change_password_view, choose_language,
login_view, logout_view, map_index, position_create, position_detail, position_list,
position_set, qr_code, register_view, report_create, report_detail, report_list)
slug = r'(?P<slug>[a-zA-Z0-9-_.:]+)'
coordinates = r'(?P<coordinates>[a-z0-9-_:]+:-?\d+(\.\d+)?:-?\d+(\.\d+)?)'
slug2 = r'(?P<slug2>[a-zA-Z0-9-_.:]+)'
details = r'(?P<details>details/)?'
nearby = r'(?P<nearby>nearby/)?'
options = r'(?P<options>options/)?'
pos = r'(@(?P<level>[a-z0-9-_:]+),(?P<x>-?\d+(\.\d+)?),(?P<y>-?\d+(\.\d+)?),(?P<zoom>-?\d+(\.\d+)?))?'
embed = r'(?P<embed>embed/)?'
register_converter(LocationConverter, 'loc')
register_converter(CoordinatesConverter, 'coords')
register_converter(AtPositionConverter, 'at_pos')
register_converter(IsEmbedConverter, 'is_embed')
embed = '<is_embed:embed>'
pos = '<at_pos:pos>'
urlpatterns = [
url(r'^%s(?P<mode>[l])/%s/(%s|%s)%s$' % (embed, slug, details, nearby, pos), map_index, name='site.index'),
url(r'^%s(?P<mode>[od])/%s/%s$' % (embed, slug, pos), map_index, name='site.index'),
url(r'^%sr/%s/%s/(%s|%s)%s$' % (embed, slug, slug2, details, options, pos), map_index, name='site.index'),
url(r'^%s(?P<mode>r)/%s$' % (embed, pos), map_index, name='site.index'),
url(r'^%s%s$' % (embed, pos), map_index, name='site.index'),
url(r'^qr/(?P<path>.*)$', qr_code, name='site.qr'),
url(r'^login$', login_view, name='site.login'),
url(r'^logout$', logout_view, name='site.logout'),
url(r'^register$', register_view, name='site.register'),
url(r'^account/$', account_view, name='site.account'),
url(r'^account/change_password$', change_password_view, name='site.account.change_password'),
url(r'^access/(?P<token>[^/]+)$', access_redeem_view, name='site.access.redeem'),
url(r'^lang/$', choose_language, name='site.language'),
url(r'^about/$', about_view, name='site.about'),
url(r'^reports/(?P<filter>(open|all))/$', report_list, name='site.report_list'),
url(r'^reports/(?P<pk>\d+)/$', report_detail, name='site.report_detail'),
url(r'^reports/(?P<pk>\d+)/(?P<secret>[^/]+)/$', report_detail, name='site.report_detail'),
url(r'^report/l/%s/$' % coordinates, report_create, name='site.report_create'),
url(r'^report/l/(?P<location>\d+)/$', report_create, name='site.report_create'),
url(r'^report/r/(?P<origin>[^/]+)/(?P<destination>[^/]+)/(?P<options>[^/]+)/$',
report_create, name='site.report_create'),
url(r'^positions/$', position_list, name='site.position_list'),
url(r'^positions/create/$', position_create, name='site.position_create'),
url(r'^positions/(?P<pk>\d+)/$', position_detail, name='site.position_detail'),
url(r'^positions/set/%s/$' % coordinates, position_set, name='site.position_set'),
path(f'{embed}l/<loc:slug>/{pos}', map_index, {'mode': 'l'}, name='site.index', ),
path(f'{embed}l/<loc:slug>/details/{pos}', map_index, {'mode': 'l', 'details': True}, name='site.index'),
path(f'{embed}l/<loc:slug>/nearby/{pos}', map_index, {'mode': 'l', 'nearby': True}, name='site.index'),
path(f'{embed}o/<loc:slug>/{pos}', map_index, {'mode': 'o'}, name='site.index'),
path(f'{embed}d/<loc:slug>/{pos}', map_index, {'mode': 'd'}, name='site.index'),
path(f'{embed}r/{pos}', map_index, {'mode': 'r'}, name='site.index'),
path(f'{embed}r/<loc:slug>/<loc:slug2>/{pos}', map_index, {'mode': 'r'}, name='site.index'),
path(f'{embed}r/<loc:slug>/<loc:slug2>/details{pos}', map_index, {'mode': 'r', 'details': True}, name='site.index'),
path(f'{embed}r/<loc:slug>/<loc:slug2>/options{pos}', map_index, {'mode': 'r', 'options': True}, name='site.index'),
path(f'{embed}r/<loc:slug>/<loc:slug2>/options{pos}', map_index, {'mode': 'r', 'options': True}, name='site.index'),
path(f'{embed}{pos}', map_index, name='site.index'),
path('qr/<path:path>', qr_code, name='site.qr'),
path('login', login_view, name='site.login'),
path('logout', logout_view, name='site.logout'),
path('register', register_view, name='site.register'),
path('account/', account_view, name='site.account'),
path('account/change_password', change_password_view, name='site.account.change_password'),
path('access/<str:token>', access_redeem_view, name='site.access.redeem'),
path('lang/', choose_language, name='site.language'),
path('about/', about_view, name='site.about'),
path('reports/open/', report_list, {'filter': 'open'}, name='site.report_list'),
path('reports/all/', report_list, {'filter': 'all'}, name='site.report_list'),
path('reports/<int:pk>/', report_detail, name='site.report_detail'),
path('reports/<int:pk>/<str:secret>/', report_detail, name='site.report_detail'),
path('report/l/<coords:coordinates>/', report_create, name='site.report_create'),
path('report/l/<int:location>/', report_create, name='site.report_create'),
path('report/r/<str:origin>/<str:destination>/<str:options>/', report_create, name='site.report_create'),
path('positions/', position_list, name='site.position_list'),
path('positions/create/', position_create, name='site.position_create'),
path('positions/<int:pk>/', position_detail, name='site.position_detail'),
path('positions/set/<coords:coordinates>/', position_set, name='site.position_set'),
]