feat: Add status, split migration to provide proper default

This commit is contained in:
2024-05-31 15:57:38 +02:00
parent aa4c4d3c60
commit 195a5ab26a
3 changed files with 157 additions and 5 deletions

View File

@@ -0,0 +1,70 @@
# Generated by Django 5.0.6 on 2024-06-06 14:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("fellchensammlung", "0009_remove_image_title"),
]
operations = [
migrations.CreateModel(
name="Status",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"major_status",
models.CharField(
choices=[
("active", "active"),
("in_review", "in review"),
("closed", "closed"),
("disabled", "disabled"),
],
max_length=200,
),
),
(
"minor_status",
models.CharField(
choices=[
("searching", "searching"),
("interested", "interested"),
("waiting_for_review", "waiting_for_review"),
(
"successful_with_notfellchen",
"successful_with_notfellchen",
),
(
"successful_without_notfellchen",
"successful_without_notfellchen",
),
("animal_died", "animal_died"),
(
"closed_for_other_adoption_notice",
"closed_for_other_adoption_notice",
),
(
"not_open_for_adoption_anymore",
"not_open_for_adoption_anymore",
),
("other", "other"),
("against_the_rules", "against_the_rules"),
("missing_information", "missing_information"),
],
max_length=200,
),
),
],
),
]

View File

@@ -0,0 +1,27 @@
# Generated by Django 5.0.6 on 2024-06-06 14:51
import django.db.models.deletion
from django.db import migrations, models
from fellchensammlung.models import Status
default_status = Status.objects.create(major_status=Status.ACTIVE, minor_status="searching")
class Migration(migrations.Migration):
dependencies = [
("fellchensammlung", "0010_status"),
]
operations = [
migrations.AddField(
model_name="adoptionnotice",
name="status",
field=models.ForeignKey(
default=default_status.pk,
on_delete=django.db.models.deletion.PROTECT,
to="fellchensammlung.status",
),
preserve_default=False,
),
]