diff --git a/seminar/models.py b/seminar/models.py index 71e5abf6..83531f21 100644 --- a/seminar/models.py +++ b/seminar/models.py @@ -218,7 +218,23 @@ class Resitel(SeminarModelBase): else: return 5 - rozdil - #def titul(self): + def titul(self, celkove_body): + "Vrati titul podle zadaneho poctu bodu." + if celkove_body < 10: + return None + elif celkove_body < 20: + return 'Bc.' + elif celkove_body < 50: + return 'Mgr.' + elif celkove_body < 100: + return 'Dr.' + elif celkove_body < 200: + return 'Doc.' + elif celkove_body < 500: + return 'Prof.' + else: + return 'Akad.' + @reversion.register(ignore_duplicate_revisions=True) diff --git a/seminar/views.py b/seminar/views.py index 3ae4db1f..94507798 100644 --- a/seminar/views.py +++ b/seminar/views.py @@ -97,6 +97,7 @@ class CisloView(generic.DetailView): tv = RadekVysledkovky() tv.resitel = v.resitel tv.rocnik = tv.resitel.rocnik(context['cislo'].datum_vydani) + tv.resitel.titul = tv.resitel.titul(v.body_celkem) tv.vysledek = v #odkazuje na VysledkyKCislu tv.body = ['']*len(problemy)