From 600d7d89b190af900e8dcc89beaaa3993d4545a0 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Tue, 29 Nov 2022 12:14:23 +0100 Subject: [PATCH] Add grammar to catalogue. --- src/catalogue/admin.py | 18 +++- ...ch_adjective_feminine_singular_and_more.py | 83 +++++++++++++++++++ src/catalogue/models.py | 28 +++++++ 3 files changed, 126 insertions(+), 3 deletions(-) create mode 100644 src/catalogue/migrations/0041_author_genitive_epoch_adjective_feminine_singular_and_more.py diff --git a/src/catalogue/admin.py b/src/catalogue/admin.py index 96af8c13..3919035b 100644 --- a/src/catalogue/admin.py +++ b/src/catalogue/admin.py @@ -42,6 +42,7 @@ class AuthorAdmin(WikidataAdminMixin, TabbedTranslationAdmin): "status", "gender", "nationality", + ("genitive", admin.EmptyFieldListFilter) ] list_per_page = 10000000 search_fields = ["first_name", "last_name", "wikidata"] @@ -335,9 +336,20 @@ admin.site.register(models.Collection, CollectionAdmin) class CategoryAdmin(admin.ModelAdmin): search_fields = ["name"] -admin.site.register(models.Epoch, CategoryAdmin) -admin.site.register(models.Genre, CategoryAdmin) -admin.site.register(models.Kind, CategoryAdmin) + +@admin.register(models.Epoch) +class EpochAdmin(CategoryAdmin): + list_display = ['name', 'adjective_feminine_singular', 'adjective_nonmasculine_plural'] + + +@admin.register(models.Genre) +class GenreAdmin(CategoryAdmin): + list_display = ['name', 'plural', 'is_epoch_specific'] + + +@admin.register(models.Kind) +class KindAdmin(CategoryAdmin): + list_display = ['name', 'collective_noun'] diff --git a/src/catalogue/migrations/0041_author_genitive_epoch_adjective_feminine_singular_and_more.py b/src/catalogue/migrations/0041_author_genitive_epoch_adjective_feminine_singular_and_more.py new file mode 100644 index 00000000..d765268a --- /dev/null +++ b/src/catalogue/migrations/0041_author_genitive_epoch_adjective_feminine_singular_and_more.py @@ -0,0 +1,83 @@ +# Generated by Django 4.0.6 on 2022-11-29 12:08 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('catalogue', '0040_collection_description'), + ] + + operations = [ + migrations.AddField( + model_name='author', + name='genitive', + field=models.CharField(blank=True, help_text='utwory … (czyje?)', max_length=255, verbose_name='dopełniacz'), + ), + migrations.AddField( + model_name='epoch', + name='adjective_feminine_singular', + field=models.CharField(blank=True, help_text='twórczość … Adama Mickiewicza', max_length=255, verbose_name='przymiotnik pojedynczy żeński'), + ), + migrations.AddField( + model_name='epoch', + name='adjective_nonmasculine_plural', + field=models.CharField(blank=True, help_text='utwory … Adama Mickiewicza', max_length=255, verbose_name='przymiotnik mnogi niemęskoosobowy'), + ), + migrations.AddField( + model_name='genre', + name='is_epoch_specific', + field=models.BooleanField(default=False, help_text='Po wskazaniu tego gatunku, dodanie epoki byłoby nadmiarowe, np. „dramat romantyczny”'), + ), + migrations.AddField( + model_name='genre', + name='plural', + field=models.CharField(blank=True, help_text='dotyczy gatunków', max_length=255, verbose_name='liczba mnoga'), + ), + migrations.AddField( + model_name='kind', + name='collective_noun', + field=models.CharField(blank=True, help_text='np. „Liryka” albo „Twórczość dramatyczna”', max_length=255, verbose_name='określenie zbiorowe'), + ), + migrations.AlterField( + model_name='author', + name='description', + field=models.TextField(blank=True, help_text='for publication', verbose_name='description'), + ), + migrations.AlterField( + model_name='author', + name='description_de', + field=models.TextField(blank=True, help_text='for publication', null=True, verbose_name='description'), + ), + migrations.AlterField( + model_name='author', + name='description_lt', + field=models.TextField(blank=True, help_text='for publication', null=True, verbose_name='description'), + ), + migrations.AlterField( + model_name='author', + name='description_pl', + field=models.TextField(blank=True, help_text='for publication', null=True, verbose_name='description'), + ), + migrations.AlterField( + model_name='author', + name='notes', + field=models.TextField(blank=True, help_text='private', verbose_name='notes'), + ), + migrations.AlterField( + model_name='book', + name='notes', + field=models.TextField(blank=True, help_text='private', verbose_name='notes'), + ), + migrations.AlterField( + model_name='collection', + name='notes', + field=models.TextField(blank=True, help_text='private', verbose_name='notes'), + ), + migrations.AlterField( + model_name='collectioncategory', + name='notes', + field=models.TextField(blank=True, help_text='private', verbose_name='notes'), + ), + ] diff --git a/src/catalogue/models.py b/src/catalogue/models.py index ea7bf54b..97454775 100644 --- a/src/catalogue/models.py +++ b/src/catalogue/models.py @@ -16,6 +16,10 @@ class Author(WikidataModel): slug = models.SlugField(max_length=255, null=True, blank=True, unique=True) first_name = models.CharField(_("first name"), max_length=255, blank=True) last_name = models.CharField(_("last name"), max_length=255, blank=True) + genitive = models.CharField( + 'dopełniacz', max_length=255, blank=True, + help_text='utwory … (czyje?)' + ) name_de = models.CharField(_("name (de)"), max_length=255, blank=True) name_lt = models.CharField(_("name (lt)"), max_length=255, blank=True) @@ -137,19 +141,43 @@ class Category(WikidataModel): def __str__(self): return self.name + class Epoch(Category): + adjective_feminine_singular = models.CharField( + 'przymiotnik pojedynczy żeński', max_length=255, blank=True, + help_text='twórczość … Adama Mickiewicza' + ) + adjective_nonmasculine_plural = models.CharField( + 'przymiotnik mnogi niemęskoosobowy', max_length=255, blank=True, + help_text='utwory … Adama Mickiewicza' + ) + class Meta: verbose_name = _('epoch') verbose_name_plural = _('epochs') class Genre(Category): + plural = models.CharField( + 'liczba mnoga', max_length=255, blank=True, + help_text='dotyczy gatunków' + ) + is_epoch_specific = models.BooleanField( + default=False, + help_text='Po wskazaniu tego gatunku, dodanie epoki byłoby nadmiarowe, np. „dramat romantyczny”' + ) + class Meta: verbose_name = _('genre') verbose_name_plural = _('genres') class Kind(Category): + collective_noun = models.CharField( + 'określenie zbiorowe', max_length=255, blank=True, + help_text='np. „Liryka” albo „Twórczość dramatyczna”' + ) + class Meta: verbose_name = _('kind') verbose_name_plural = _('kinds') -- 2.20.1