fix: fix field type

This commit is contained in:
moanos [he/him] 2024-04-14 14:14:35 +02:00
parent 223c9f2f9b
commit 11d5e2a9ee
3 changed files with 58 additions and 2 deletions

View File

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

View File

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

View File

@ -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})"