From 5602e314695f31442057581ee7ad6535c60aae36 Mon Sep 17 00:00:00 2001 From: moanos Date: Mon, 18 Mar 2024 14:26:50 +0100 Subject: [PATCH] feat(models): Add markdown content class --- .../migrations/0003_markdowncontent.py | 24 +++++++++++++++++++ src/fellchensammlung/models.py | 16 ++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 src/fellchensammlung/migrations/0003_markdowncontent.py diff --git a/src/fellchensammlung/migrations/0003_markdowncontent.py b/src/fellchensammlung/migrations/0003_markdowncontent.py new file mode 100644 index 0000000..ad5b9f2 --- /dev/null +++ b/src/fellchensammlung/migrations/0003_markdowncontent.py @@ -0,0 +1,24 @@ +# Generated by Django 5.0.3 on 2024-03-18 13:25 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('fellchensammlung', '0002_remove_animal_adoption_notice_adoptionnotice_animals'), + ] + + operations = [ + migrations.CreateModel( + name='MarkdownContent', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=100)), + ('content', models.TextField()), + ], + options={ + 'verbose_name_plural': 'Markdown content', + }, + ), + ] diff --git a/src/fellchensammlung/models.py b/src/fellchensammlung/models.py index f53c376..993bbac 100644 --- a/src/fellchensammlung/models.py +++ b/src/fellchensammlung/models.py @@ -48,7 +48,6 @@ class RescueOrganization(models.Model): website = models.URLField(null=True, blank=True, verbose_name=_('Website')) - class Animal(models.Model): def __str__(self): return f"{self.name}" @@ -58,6 +57,7 @@ class Animal(models.Model): description = models.TextField(null=True, blank=True, verbose_name=_('Description')) species = models.ForeignKey(Species, on_delete=models.PROTECT) + class AdoptionNotice(models.Model): def __str__(self): return f"{self.name}" @@ -72,3 +72,17 @@ class AdoptionNotice(models.Model): group_only = models.BooleanField(default=False, verbose_name=_('Only group adoption')) animals = models.ManyToManyField(Animal) + +class MarkdownContent(models.Model): + """ + Base class to store markdown content + """ + title = models.CharField(max_length=100) + content = models.TextField() + + class Meta: + verbose_name_plural = "Markdown content" + + def __str__(self): + return self.title +