summaryrefslogtreecommitdiff
path: root/ishtar_common
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common')
-rw-r--r--ishtar_common/admin.py19
-rw-r--r--ishtar_common/migrations/0206_auto_20201206_2316.py30
-rw-r--r--ishtar_common/models.py17
3 files changed, 62 insertions, 4 deletions
diff --git a/ishtar_common/admin.py b/ishtar_common/admin.py
index f8c2ea30d..082436dc5 100644
--- a/ishtar_common/admin.py
+++ b/ishtar_common/admin.py
@@ -908,8 +908,8 @@ class GeneralTypeAdmin(ImportActionAdmin, ImportJSONActionAdmin):
save_on_top = True
actions = [export_as_csv_action(), serialize_type_action]
prepopulated_fields = {"txt_idx": ("label",)}
- extra_list_display = []
LIST_DISPLAY = ['label', 'txt_idx', 'available', 'comment']
+ extra_list_display = []
def get_list_display(self, request):
list_display = list(self.LIST_DISPLAY)[:]
@@ -973,14 +973,25 @@ class GeneralTypeAdmin(ImportActionAdmin, ImportJSONActionAdmin):
request, object_id, form_url, extra_context)
-general_models = [models.OrganizationType, models.SourceType,
- models.AuthorType, models.TitleType,
- models.PersonType, models.LicenseType,
+general_models = [models.SourceType, models.AuthorType, models.LicenseType,
models.Language]
for model in general_models:
admin_site.register(model, GeneralTypeAdmin)
+@admin.register(models.OrganizationType, site=admin_site)
+@admin.register(models.PersonType, site=admin_site)
+class PersonTypeAdmin(GeneralTypeAdmin):
+ LIST_DISPLAY = ['label', 'grammatical_gender', 'txt_idx', 'available',
+ 'comment']
+
+
+@admin.register(models.TitleType, site=admin_site)
+class TitleType(GeneralTypeAdmin):
+ LIST_DISPLAY = ['label', 'long_title', 'txt_idx', 'available',
+ 'comment']
+
+
class CreateAreaForm(forms.Form):
department_number = forms.IntegerField(label=_("Department number"))
area_name = forms.CharField(label=_("Area name"), required=False)
diff --git a/ishtar_common/migrations/0206_auto_20201206_2316.py b/ishtar_common/migrations/0206_auto_20201206_2316.py
new file mode 100644
index 000000000..62f6dd1b0
--- /dev/null
+++ b/ishtar_common/migrations/0206_auto_20201206_2316.py
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.27 on 2020-12-06 23:16
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('ishtar_common', '0205_auto_20201203_1453'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='organizationtype',
+ name='grammatical_gender',
+ field=models.CharField(blank=True, choices=[('M', 'Male'), ('F', 'Female'), ('N', 'Neutral')], default='', max_length=1, verbose_name='Grammatical gender'),
+ ),
+ migrations.AddField(
+ model_name='persontype',
+ name='grammatical_gender',
+ field=models.CharField(blank=True, choices=[('M', 'Male'), ('F', 'Female'), ('N', 'Neutral')], default='', max_length=1, verbose_name='Grammatical gender'),
+ ),
+ migrations.AddField(
+ model_name='titletype',
+ name='long_title',
+ field=models.TextField(blank=True, default='', verbose_name='Long title'),
+ ),
+ ]
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index e841690bb..cf0a41c54 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -1631,7 +1631,18 @@ class Area(HierarchicalType):
return " / ".join(label)
+GENDER = (
+ ("M", _("Male")),
+ ("F", _("Female")),
+ ("N", _("Neutral")),
+)
+
+
class OrganizationType(GeneralType):
+ grammatical_gender = models.CharField(
+ _("Grammatical gender"), max_length=1, choices=GENDER,
+ blank=True, default="")
+
class Meta:
verbose_name = _("Organization type")
verbose_name_plural = _("Organization types")
@@ -1770,6 +1781,10 @@ post_save.connect(cached_label_changed, sender=Organization)
class PersonType(GeneralType):
+ grammatical_gender = models.CharField(
+ _("Grammatical gender"), max_length=1, choices=GENDER,
+ blank=True, default="")
+
class Meta:
verbose_name = _("Person type")
verbose_name_plural = _("Person types")
@@ -1833,6 +1848,8 @@ def get_publisher_label():
class TitleType(GeneralType):
+ long_title = models.TextField(_("Long title"), default="", blank=True)
+
class Meta:
verbose_name = _("Title type")
verbose_name_plural = _("Title types")