Přidán handler pro /profil/

This commit is contained in:
Pavel "LEdoian" Turinsky 2020-09-04 16:28:38 +02:00
parent a82230e1fe
commit b96187f60c
2 changed files with 15 additions and 0 deletions

View file

@ -104,6 +104,9 @@ urlpatterns = [
path('reset_password_complete/', views.PasswordResetCompleteView.as_view(), name='reset_password_complete'),
path('resitel_edit', views.resitelEditView, name='seminar_resitel_edit'),
# Obecný view na profil -- orgům dá rozcestník, řešitelům jejich stránku
path('profil/', views.profilView, name='profil'),
# Autocomplete
path('autocomplete/skola/',views.SkolaAutocomplete.as_view(), name='autocomplete_skola'),
path('autocomplete/resitel/',views.ResitelAutocomplete.as_view(), name='autocomplete_resitel'),

View file

@ -1306,3 +1306,15 @@ class PasswordResetCompleteView(auth_views.PasswordResetCompleteView):
class PasswordChangeView(auth_views.PasswordChangeView):
#template_name = 'seminar/password_change.html'
success_url = reverse_lazy('titulni_strana')
# Jen hloupé rozhazovátko
def profilView(request):
user = request.user
# FIXME: správná oprávnění
if user.has_perm('org'):
return OrgoRozcestnikView.as_view()(request)
if user.has_perm('ucastnik'):
return ResitelView.as_view()(request)
else:
return LoginView.as_view()(request)