def tk_prepostfix(title, arg='longslash'): """ :param str arg: postfixtype til :func:`tktitler.prepostfix`. Det er ikke muligt at ændre prefixtype. """ return tk.prepostfix(title, gfyear=config.GFYEAR, prefixtype='unicode', postfixtype=arg)
def get_titles(self, profile): titles = list(profile.title_set.all()) if titles: with tk.set_gfyear(config.GFYEAR): return ', '.join( sorted( tk.prepostfix(t, prefixtype="unicode") for t in titles))
def choices(self, cl): gfyear = config.GFYEAR for choice in super(TitlePeriodFilter, self).choices(cl): try: period = int(choice['display']) except ValueError: pass except TypeError: pass else: choice['display'] = tk.prepostfix(('BEST/FU', period), gfyear=gfyear, prefixtype='unicode') yield choice
def test_prepostfix(self): self.assertEqual(tk.prepostfix(self.form(2015), 2016), 'GFORM 2015/16')
def test_old_title(self): self.assertEqual(tk.prepostfix(("BEST", 1957), 2016), "T56OBEST")
def test_EFUIT(self): self.assertEqual(tk.prepostfix(("EFUIT", 2011), 2016), "T2OEFUIT")
def test_year_plus_03(self): self.assertEqual(tk.prepostfix(("CERM", 2019), 2016), "K3CERM 2019/20")
def test_year_minus_05(self): self.assertEqual(tk.prepostfix(("CERM", 2011), 2016), "T2OCERM 2011/12")
def test_sameyear(self): self.assertEqual(tk.prepostfix(("CERM", 2016), 2016), "CERM 2016/17")
def get_period(self, title): return tk.prepostfix((title.get_kind_display(), title.period), config.GFYEAR, prefixtype='unicode')
def get_display_title(self, title): return tk.prepostfix(title, config.GFYEAR, prefixtype='unicode')