Browse Source

Přidán handler pro /profil/

middleware_test
Pavel "LEdoian" Turinsky 4 years ago
parent
commit
b96187f60c
  1. 3
      seminar/urls.py
  2. 12
      seminar/views/views_all.py

3
seminar/urls.py

@ -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'),

12
seminar/views/views_all.py

@ -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)

Loading…
Cancel
Save