class CategoryAdmin(admin.ModelAdmin):
search_fields = ["name"]
+ def has_description(self, obj):
+ return bool(obj.description)
+ has_description.boolean = True
+ has_description.short_description = 'opis'
+
@admin.register(models.Epoch)
class EpochAdmin(CategoryAdmin):
- list_display = ['name', 'adjective_feminine_singular', 'adjective_nonmasculine_plural']
+ list_display = [
+ 'name',
+ 'adjective_feminine_singular',
+ 'adjective_nonmasculine_plural',
+ 'has_description',
+ ]
@admin.register(models.Genre)
class GenreAdmin(CategoryAdmin):
- list_display = ['name', 'plural', 'is_epoch_specific']
+ list_display = [
+ 'name',
+ 'plural',
+ 'is_epoch_specific',
+ 'has_description',
+ ]
@admin.register(models.Kind)
class KindAdmin(CategoryAdmin):
- list_display = ['name', 'collective_noun']
+ list_display = [
+ 'name',
+ 'collective_noun',
+ 'has_description',
+ ]
--- /dev/null
+# Generated by Django 4.0.6 on 2022-12-19 15:06
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('catalogue', '0043_book_monthly_views_page_book_monthly_views_reader'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='epoch',
+ name='description',
+ field=models.TextField(blank=True, help_text='for publication', verbose_name='description'),
+ ),
+ migrations.AddField(
+ model_name='genre',
+ name='description',
+ field=models.TextField(blank=True, help_text='for publication', verbose_name='description'),
+ ),
+ migrations.AddField(
+ model_name='kind',
+ name='description',
+ field=models.TextField(blank=True, help_text='for publication', verbose_name='description'),
+ ),
+ ]
class Category(WikidataModel):
name = models.CharField(_("name"), max_length=255)
slug = models.SlugField(max_length=255, unique=True)
+ description = models.TextField(_("description"), blank=True, help_text=_('for publication'))
class Meta:
abstract = True