# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from django.contrib import admin
+from django.utils.translation import gettext_lazy as _
from . import models
from .wikidata import WikidataAdminMixin
"last_name",
"status",
"year_of_death",
+ "gender",
+ "nationality",
"priority",
"wikidata_link",
"slug",
]
- list_filter = ["year_of_death", "priority", "collections", "status"]
+ list_filter = ["year_of_death", "priority", "collections", "status", "gender", "nationality"]
search_fields = ["first_name", "last_name", "wikidata"]
prepopulated_fields = {"slug": ("first_name", "last_name")}
autocomplete_fields = ["collections"]
"wikidata_link",
]
search_fields = ["title", "wikidata"]
- autocomplete_fields = ["authors", "translators", "based_on", "collections"]
+ autocomplete_fields = ["authors", "translators", "based_on", "collections", "epochs", "genres", "kinds"]
prepopulated_fields = {"slug": ("title",)}
list_filter = ["language", "pd_year", "collections"]
readonly_fields = ["wikidata_link"]
fieldsets = [
(None, {"fields": [("wikidata", "wikidata_link")]}),
(
- "Identification",
+ _("Identification"),
{
"fields": [
"title",
},
),
(
- "Plan",
+ _("Features"),
+ {
+ "fields": [
+ "epochs",
+ "genres",
+ "kinds",
+ ]
+ },
+ ),
+ (
+ _("Plan"),
{
"fields": [
"scans_source",
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)
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
class WIKIDATA:
+ GENDER = "P21"
AUTHOR = "P50"
LANGUAGE = "P407"
DATE_OF_DEATH = "P570"
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-04-20 16:44+0200\n"
-"PO-Revision-Date: 2020-04-20 16:52+0200\n"
+"POT-Creation-Date: 2020-10-27 14:25+0100\n"
+"PO-Revision-Date: 2020-10-27 14:25+0100\n"
+"Last-Translator: \n"
+"Language-Team: \n"
"Language: pl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && (n"
"%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n"
"%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);\n"
-"Last-Translator: \n"
-"Language-Team: \n"
-"X-Generator: Poedit 2.2.4\n"
+"X-Generator: Poedit 2.3\n"
+
+#: catalogue/admin.py:49
+msgid "Identification"
+msgstr "Identyfikacja"
-#: models.py:22
+#: catalogue/admin.py:63
+msgid "Features"
+msgstr "Cechy"
+
+#: catalogue/admin.py:73
+msgid "Plan"
+msgstr "Plan"
+
+#: catalogue/models.py:26
msgid "Alive"
msgstr "Żyje"
-#: models.py:23
+#: catalogue/models.py:27
msgid "Dead"
msgstr "Zmarły"
-#: models.py:24
+#: catalogue/models.py:28
msgid "Long dead"
msgstr "Dawno zmarły"
-#: models.py:25
+#: catalogue/models.py:29
msgid "Unknown"
msgstr "Nieznany"
-#: models.py:37 models.py:83
+#: catalogue/models.py:41 catalogue/models.py:120
msgid "Low"
msgstr "Niski"
-#: models.py:37 models.py:83
+#: catalogue/models.py:41 catalogue/models.py:120
msgid "Medium"
msgstr "Średni"
-#: models.py:37 models.py:83
+#: catalogue/models.py:41 catalogue/models.py:120
msgid "High"
msgstr "Wysoki"
-#: templates/catalogue/catalogue.html:7 templates/catalogue/catalogue.html:13
+#: catalogue/models.py:46
+msgid "author"
+msgstr "autor"
+
+#: catalogue/models.py:47
+msgid "authors"
+msgstr "autorzy"
+
+#: catalogue/models.py:83
+msgid "epoch"
+msgstr "epoka"
+
+#: catalogue/models.py:84
+msgid "epochs"
+msgstr "epoki"
+
+#: catalogue/models.py:89
+msgid "genre"
+msgstr "gatunek"
+
+#: catalogue/models.py:90
+msgid "genres"
+msgstr "gatunki"
+
+#: catalogue/models.py:95
+msgid "kind"
+msgstr "rodzaj"
+
+#: catalogue/models.py:96
+msgid "kinds"
+msgstr "rodzaje"
+
+#: catalogue/models.py:130
+msgid "book"
+msgstr "książka"
+
+#: catalogue/models.py:131
+msgid "books"
+msgstr "książki"
+
+#: catalogue/models.py:170
+msgid "collection"
+msgstr "kolekcja"
+
+#: catalogue/models.py:171
+msgid "collections"
+msgstr "kolekcje"
+
+#: catalogue/templates/catalogue/author_detail.html:7
+#: catalogue/templates/catalogue/author_detail.html:13
+#: catalogue/templates/catalogue/book_detail.html:7
+#: catalogue/templates/catalogue/book_detail.html:13
+#: catalogue/templates/catalogue/catalogue.html:7
+#: catalogue/templates/catalogue/catalogue.html:13
msgid "Catalogue"
msgstr "Katalog"
-#: templates/catalogue/catalogue.html:67
+#: catalogue/templates/catalogue/author_detail.html:66
+#: catalogue/templates/catalogue/catalogue.html:67
msgid "trans."
msgstr "tłum."
-#: templates/catalogue/catalogue.html:90
+#: catalogue/templates/catalogue/catalogue.html:90
#, python-format
msgid "%(c)s author"
msgid_plural "%(c)s authors"
msgstr[2] "%(c)s autorów"
msgstr[3] ""
-#: wikidata.py:18
+#: catalogue/wikidata.py:18
msgid "If you have a Wikidata ID, like \"Q1337\", enter it and save."
-msgstr ""
-"Jeśli masz identyfikator Wikidanych , jak „Q1337”, wklej go i zapisz."
+msgstr "Jeśli masz identyfikator Wikidanych , jak „Q1337”, wklej go i zapisz."
--- /dev/null
+# Generated by Django 3.0.4 on 2020-10-27 13:31
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('catalogue', '0018_auto_20200417_1859'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='author',
+ name='gender',
+ field=models.CharField(blank=True, max_length=255),
+ ),
+ migrations.AddField(
+ model_name='author',
+ name='nationality',
+ field=models.CharField(blank=True, max_length=255),
+ ),
+ ]
--- /dev/null
+# Generated by Django 3.0.4 on 2020-10-27 14:16
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('catalogue', '0019_auto_20201027_1331'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Epoch',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('wikidata', models.CharField(blank=True, help_text='If you have a Wikidata ID, like "Q1337", enter it and save.', max_length=255)),
+ ('name', models.CharField(max_length=255)),
+ ('slug', models.SlugField(max_length=255, unique=True)),
+ ],
+ options={
+ 'abstract': False,
+ },
+ ),
+ migrations.CreateModel(
+ name='Genre',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('wikidata', models.CharField(blank=True, help_text='If you have a Wikidata ID, like "Q1337", enter it and save.', max_length=255)),
+ ('name', models.CharField(max_length=255)),
+ ('slug', models.SlugField(max_length=255, unique=True)),
+ ],
+ options={
+ 'abstract': False,
+ },
+ ),
+ migrations.CreateModel(
+ name='Kind',
+ fields=[
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('wikidata', models.CharField(blank=True, help_text='If you have a Wikidata ID, like "Q1337", enter it and save.', max_length=255)),
+ ('name', models.CharField(max_length=255)),
+ ('slug', models.SlugField(max_length=255, unique=True)),
+ ],
+ options={
+ 'abstract': False,
+ },
+ ),
+ migrations.AddField(
+ model_name='book',
+ name='epochs',
+ field=models.ManyToManyField(blank=True, to='catalogue.Epoch'),
+ ),
+ migrations.AddField(
+ model_name='book',
+ name='genres',
+ field=models.ManyToManyField(blank=True, to='catalogue.Genre'),
+ ),
+ migrations.AddField(
+ model_name='book',
+ name='kinds',
+ field=models.ManyToManyField(blank=True, to='catalogue.Kind'),
+ ),
+ ]
--- /dev/null
+# Generated by Django 3.0.4 on 2020-10-27 14:22
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('catalogue', '0020_auto_20201027_1416'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+ name='author',
+ options={'ordering': ('last_name', 'first_name', 'year_of_death'), 'verbose_name': 'author', 'verbose_name_plural': 'authors'},
+ ),
+ migrations.AlterModelOptions(
+ name='book',
+ options={'ordering': ('title',), 'verbose_name': 'book', 'verbose_name_plural': 'books'},
+ ),
+ migrations.AlterModelOptions(
+ name='collection',
+ options={'verbose_name': 'collection', 'verbose_name_plural': 'collections'},
+ ),
+ migrations.AlterModelOptions(
+ name='epoch',
+ options={'verbose_name': 'author', 'verbose_name_plural': 'authors'},
+ ),
+ migrations.AlterModelOptions(
+ name='genre',
+ options={'verbose_name': 'genre', 'verbose_name_plural': 'genres'},
+ ),
+ migrations.AlterModelOptions(
+ name='kind',
+ options={'verbose_name': 'kind', 'verbose_name_plural': 'kinds'},
+ ),
+ ]
--- /dev/null
+# Generated by Django 3.0.4 on 2020-10-27 14:24
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('catalogue', '0021_auto_20201027_1422'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+ name='epoch',
+ options={'verbose_name': 'epoch', 'verbose_name_plural': 'epochs'},
+ ),
+ ]
from django.db import models
from django.urls import reverse
from django.utils.translation import gettext_lazy as _
+from wikidata.client import Client
from .constants import WIKIDATA
from .utils import UnrelatedManager
from .wikidata import WikidataMixin
name_de = models.CharField(max_length=255, blank=True)
name_lt = models.CharField(max_length=255, blank=True)
+ gender = models.CharField(max_length=255, blank=True)
+ nationality = models.CharField(max_length=255, blank=True)
year_of_death = models.SmallIntegerField(null=True, blank=True)
status = models.PositiveSmallIntegerField(
null=True,
collections = models.ManyToManyField("Collection", blank=True)
class Meta:
+ verbose_name = _('author')
+ verbose_name_plural = _('authors')
ordering = ("last_name", "first_name", "year_of_death")
class Wikidata:
first_name = WIKIDATA.GIVEN_NAME
last_name = WIKIDATA.LAST_NAME
year_of_death = WIKIDATA.DATE_OF_DEATH
+ gender = WIKIDATA.GENDER
notes = "description"
def __str__(self):
else:
return None
+
+class Category(WikidataMixin, models.Model):
+ name = models.CharField(max_length=255)
+ slug = models.SlugField(max_length=255, unique=True)
+
+ class Meta:
+ abstract = True
+
+
+class Epoch(Category):
+ class Meta:
+ verbose_name = _('epoch')
+ verbose_name_plural = _('epochs')
+
+
+class Genre(Category):
+ class Meta:
+ verbose_name = _('genre')
+ verbose_name_plural = _('genres')
+
+
+class Kind(Category):
+ class Meta:
+ verbose_name = _('kind')
+ verbose_name_plural = _('kinds')
+
+
class Book(WikidataMixin, models.Model):
slug = models.SlugField(max_length=255, blank=True, null=True, unique=True)
authors = models.ManyToManyField(Author, blank=True)
related_query_name="translated_book",
blank=True,
)
+ epochs = models.ManyToManyField(Epoch, blank=True)
+ kinds = models.ManyToManyField(Kind, blank=True)
+ genres = models.ManyToManyField(Genre, blank=True)
title = models.CharField(max_length=255, blank=True)
language = models.CharField(max_length=255, blank=True)
based_on = models.ForeignKey(
class Meta:
ordering = ("title",)
+ verbose_name = _('book')
+ verbose_name_plural = _('books')
class Wikidata:
authors = WIKIDATA.AUTHOR
name = models.CharField(max_length=255)
slug = models.SlugField(max_length=255, unique=True)
+ class Meta:
+ verbose_name = _('collection')
+ verbose_name_plural = _('collections')
+
def __str__(self):
return self.name
+