Novější syntaxe super()
This commit is contained in:
parent
ead67e4a82
commit
5f5ad7029b
1 changed files with 6 additions and 6 deletions
|
@ -31,12 +31,12 @@ class KorekturyListView(generic.ListView):
|
||||||
|
|
||||||
class KorekturyAktualniListView(KorekturyListView):
|
class KorekturyAktualniListView(KorekturyListView):
|
||||||
def get_queryset(self, *args, **kwargs):
|
def get_queryset(self, *args, **kwargs):
|
||||||
queryset=super(KorekturyAktualniListView,self).get_queryset()
|
queryset=super().get_queryset()
|
||||||
queryset=queryset.exclude(status="zastarale")
|
queryset=queryset.exclude(status="zastarale")
|
||||||
return queryset
|
return queryset
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(KorekturyAktualniListView,self).get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
context['selected'] = 'aktualni'
|
context['selected'] = 'aktualni'
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
@ -44,14 +44,14 @@ class KorekturyAktualniListView(KorekturyListView):
|
||||||
|
|
||||||
class KorekturyZastaraleListView(KorekturyListView):
|
class KorekturyZastaraleListView(KorekturyListView):
|
||||||
def get_queryset(self, *args, **kwargs):
|
def get_queryset(self, *args, **kwargs):
|
||||||
queryset=super(KorekturyZastaraleListView,self).get_queryset()
|
queryset=super().get_queryset()
|
||||||
queryset=queryset.filter(status="zastarale")
|
queryset=queryset.filter(status="zastarale")
|
||||||
# reversed, aby bylo nejaktuálnější pdf nahoře TODO lépe vyřešit?
|
# reversed, aby bylo nejaktuálnější pdf nahoře TODO lépe vyřešit?
|
||||||
# (řazení KorekturovanePDF zase chceme řadit -cas, protože jsou pak správně v adminu)
|
# (řazení KorekturovanePDF zase chceme řadit -cas, protože jsou pak správně v adminu)
|
||||||
return reversed(queryset)
|
return reversed(queryset)
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(KorekturyZastaraleListView,self).get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
context['selected'] = 'zastarale'
|
context['selected'] = 'zastarale'
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ class KorekturyView(generic.TemplateView):
|
||||||
send_mail(subject, text, from_email, list(emails))
|
send_mail(subject, text, from_email, list(emails))
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super(KorekturyView,self).get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
pdf = get_object_or_404(KorekturovanePDF, id=self.kwargs['pdf'])
|
pdf = get_object_or_404(KorekturovanePDF, id=self.kwargs['pdf'])
|
||||||
context['pdf'] = pdf
|
context['pdf'] = pdf
|
||||||
context['img_prefix'] = pdf.get_prefix()
|
context['img_prefix'] = pdf.get_prefix()
|
||||||
|
@ -252,5 +252,5 @@ class KorekturyView(generic.TemplateView):
|
||||||
return context
|
return context
|
||||||
|
|
||||||
def form_valid(self,form):
|
def form_valid(self,form):
|
||||||
return super(KorekturyView,self).form_valid(form)
|
return super().form_valid(form)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue