diff --git a/src/fellchensammlung/migrations/0005_alter_text_content_alter_text_language_and_more.py b/src/fellchensammlung/migrations/0005_alter_text_content_alter_text_language_and_more.py new file mode 100644 index 0000000..9fb943e --- /dev/null +++ b/src/fellchensammlung/migrations/0005_alter_text_content_alter_text_language_and_more.py @@ -0,0 +1,33 @@ +# Generated by Django 5.0.3 on 2024-04-14 12:06 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("fellchensammlung", "0004_alter_text_options"), + ] + + operations = [ + migrations.AlterField( + model_name="text", + name="content", + field=models.TextField(verbose_name="Inhalt"), + ), + migrations.AlterField( + model_name="text", + name="language", + field=models.OneToOneField( + on_delete=django.db.models.deletion.PROTECT, + to="fellchensammlung.language", + verbose_name="Sprache", + ), + ), + migrations.AlterField( + model_name="text", + name="text_code", + field=models.CharField(blank=True, max_length=24, verbose_name="Text code"), + ), + ] diff --git a/src/fellchensammlung/migrations/0006_alter_text_language.py b/src/fellchensammlung/migrations/0006_alter_text_language.py new file mode 100644 index 0000000..9fcbebf --- /dev/null +++ b/src/fellchensammlung/migrations/0006_alter_text_language.py @@ -0,0 +1,23 @@ +# Generated by Django 5.0.3 on 2024-04-14 12:12 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("fellchensammlung", "0005_alter_text_content_alter_text_language_and_more"), + ] + + operations = [ + migrations.AlterField( + model_name="text", + name="language", + field=models.ForeignKey( + on_delete=django.db.models.deletion.PROTECT, + to="fellchensammlung.language", + verbose_name="Sprache", + ), + ), + ] diff --git a/src/fellchensammlung/models.py b/src/fellchensammlung/models.py index bf16199..bd1ac77 100644 --- a/src/fellchensammlung/models.py +++ b/src/fellchensammlung/models.py @@ -333,7 +333,7 @@ class Text(models.Model): """ title = models.CharField(max_length=100) content = models.TextField(verbose_name="Inhalt") - language = models.OneToOneField(Language, verbose_name="Sprache", on_delete=models.PROTECT) + language = models.ForeignKey(Language, verbose_name="Sprache", on_delete=models.PROTECT) text_code = models.CharField(max_length=24, verbose_name="Text code", blank=True) class Meta: @@ -341,4 +341,4 @@ class Text(models.Model): verbose_name_plural = "Texte" def __str__(self): - return self.title + return f"{self.title} ({self.language})"