|
@ -270,6 +270,21 @@ class Cislo(SeminarModelBase): |
|
|
def verejne_url(self): |
|
|
def verejne_url(self): |
|
|
return reverse('seminar_cislo', kwargs={'pk': self.id}) |
|
|
return reverse('seminar_cislo', kwargs={'pk': self.id}) |
|
|
|
|
|
|
|
|
|
|
|
def nasledujici(self): |
|
|
|
|
|
u"Vrací None, pokud je toto poslední" |
|
|
|
|
|
return self.relativni_v_rocniku(1) |
|
|
|
|
|
|
|
|
|
|
|
def predchozi(self): |
|
|
|
|
|
u"Vrací None, pokud je toto první" |
|
|
|
|
|
return self.relativni_v_rocniku(1) |
|
|
|
|
|
|
|
|
|
|
|
def relativni_v_rocniku(self, rel_index): |
|
|
|
|
|
u"Číslo o `index` dále v ročníku. None pokud neexistuje." |
|
|
|
|
|
cs = self.rocnik.cisla.order_by('cislo').all() |
|
|
|
|
|
i = list(cs).index(self) + rel_index |
|
|
|
|
|
if (i < 0) or (i >= len(cs)): |
|
|
|
|
|
return None |
|
|
|
|
|
return cs[i] |
|
|
|
|
|
|
|
|
@reversion.register(ignore_duplicate_revisions=True) |
|
|
@reversion.register(ignore_duplicate_revisions=True) |
|
|
@python_2_unicode_compatible |
|
|
@python_2_unicode_compatible |
|
|