Browse Source

Přidán redirect na aktuální ročník

Fixní do meníčka
export_seznamu_prednasek
Pavel "LEdoian" Turinsky 4 years ago
parent
commit
6688603556
  1. 24
      data/sitetree.json
  2. 1
      seminar/urls.py
  3. 10
      seminar/views/views_all.py

24
data/sitetree.json

@ -832,5 +832,29 @@
},
"model": "sitetree.treeitem",
"pk": 42
},
{
"fields": {
"access_guest": false,
"access_loggedin": false,
"access_perm_type": 1,
"access_permissions": [],
"access_restricted": false,
"alias": null,
"description": "",
"hidden": false,
"hint": "",
"inbreadcrumbs": true,
"inmenu": true,
"insitetree": true,
"parent": 3,
"sort_order": 43,
"title": "Aktuální ročník",
"tree": 1,
"url": "seminar_aktualni_rocnik",
"urlaspattern": true
},
"model": "sitetree.treeitem",
"pk": 43
}
]

1
seminar/urls.py

@ -61,6 +61,7 @@ urlpatterns = [
path('aktualni/zadani/', views.AktualniZadaniView, name='seminar_aktualni_zadani'),
#path('aktualni/temata/', views.ZadaniTemataView, name='seminar_temata'),
path('aktualni/vysledkova-listina/', views.ZadaniAktualniVysledkovkaView, name='seminar_aktualni_vysledky'),
path('aktualni/rocnik/', views.AktualniRocnikRedirectView.as_view(), name='seminar_aktualni_rocnik'),
path('stare-novinky/', views.StareNovinkyView.as_view(), name='stare_novinky'),
# Clanky

10
seminar/views/views_all.py

@ -11,7 +11,7 @@ from django.http import Http404,HttpResponseBadRequest,HttpResponseRedirect
from django.db.models import Q, Sum, Count
from django.views.decorators.csrf import ensure_csrf_cookie
from django.views.generic.edit import FormView, CreateView
from django.views.generic.base import TemplateView
from django.views.generic.base import TemplateView, RedirectView
from django.contrib.auth import authenticate, login, get_user_model, logout
from django.contrib.auth import views as auth_views
from django.contrib.auth.models import User, Permission
@ -1327,3 +1327,11 @@ class JakResitView(generic.ListView):
def get_queryset(self):
return None
class AktualniRocnikRedirectView(RedirectView):
permanent=False
pattern_name = 'seminar_rocnik'
def get_redirect_url(self, *args, **kwargs):
aktualni_rocnik = m.Nastaveni.get_solo().aktualni_rocnik.rocnik
return super().get_redirect_url(rocnik=aktualni_rocnik, *args, **kwargs)

Loading…
Cancel
Save