feat(models): Add markdown content class

This commit is contained in:
moanos [he/him] 2024-03-18 14:26:50 +01:00
parent 3e0d0cf855
commit 5602e31469
2 changed files with 39 additions and 1 deletions

View File

@ -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',
},
),
]

View File

@ -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