diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-01-08 11:25:18 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-02-28 12:15:23 +0100 |
commit | c9c39f8b3160ab6c4bef8e790fb805914f394ded (patch) | |
tree | 0092dd5daa3d5c1be17b114463334d9681d63b7c /ishtar_common/models.py | |
parent | dedd15f6cc661a46300012f65dc1bf37c0066bcb (diff) | |
download | Ishtar-c9c39f8b3160ab6c4bef8e790fb805914f394ded.tar.bz2 Ishtar-c9c39f8b3160ab6c4bef8e790fb805914f394ded.zip |
Jinja filter: lowerfirst - fix grammatical_gender export in templates
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r-- | ishtar_common/models.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 6ac197af4..98546c727 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -1755,6 +1755,17 @@ class GenderedType(GeneralType): doc += ' "{}": {}'.format(key, label) return doc + def get_values(self, prefix='', **kwargs): + dct = { + prefix: self.label, + prefix + "id": self.pk, + prefix + "txt_idx": self.txt_idx, + prefix + "grammatical_gender": self.grammatical_gender + } + if prefix: + dct[prefix[:-1]] = self.label + return dct + class OrganizationType(GenderedType): class Meta: @@ -1983,14 +1994,8 @@ class TitleType(GenderedType): return doc def get_values(self, prefix='', **kwargs): - dct = { - prefix: self.label, - prefix + "id": self.pk, - prefix + "txt_idx": self.txt_idx, - prefix + "long_title": self.long_title - } - if prefix: - dct[prefix[:-1]] = self.label + dct = super(TitleType, self).get_values(prefix=prefix, **kwargs) + dct[prefix + "long_title"] = self.long_title return dct |