diff --git a/src/fellchensammlung/migrations/0005_rescueorganization_allows_using_materials_and_more.py b/src/fellchensammlung/migrations/0005_rescueorganization_allows_using_materials_and_more.py new file mode 100644 index 0000000..fe328c2 --- /dev/null +++ b/src/fellchensammlung/migrations/0005_rescueorganization_allows_using_materials_and_more.py @@ -0,0 +1,24 @@ +# Generated by Django 5.1.1 on 2024-09-28 20:59 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('fellchensammlung', '0004_rename_created_by_adoptionnotice_owner_and_more'), + ] + + operations = [ + migrations.AddField( + model_name='rescueorganization', + name='allows_using_materials', + field=models.CharField(choices=[('allowed', 'Usage allowed'), ('requested', 'Usage requested'), ('denied', 'Usage denied'), ('other', "It's complicated"), ('not_asked', 'Not asked')], default='Not asked', max_length=200, verbose_name='Erlaubt Nutzung von Inhalten'), + ), + migrations.AlterField( + model_name='rescueorganization', + name='location', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='fellchensammlung.location'), + ), + ] diff --git a/src/fellchensammlung/models.py b/src/fellchensammlung/models.py index 12d2a28..b5910fc 100644 --- a/src/fellchensammlung/models.py +++ b/src/fellchensammlung/models.py @@ -139,10 +139,25 @@ class RescueOrganization(models.Model): def __str__(self): return f"{self.name}" + USE_MATERIALS_ALLOWED = "allowed" + USE_MATERIALS_REQUESTED = "requested" + USE_MATERIALS_DENIED = "denied" + USE_MATERIALS_OTHER = "other" + USE_MATERIALS_NOT_ASKED = "not_asked" + + ALLOW_USE_MATERIALS_CHOICE = { + USE_MATERIALS_ALLOWED: "Usage allowed", + USE_MATERIALS_REQUESTED: "Usage requested", + USE_MATERIALS_DENIED: "Usage denied", + USE_MATERIALS_OTHER: "It's complicated", + USE_MATERIALS_NOT_ASKED: "Not asked" + } + name = models.CharField(max_length=200) trusted = models.BooleanField(default=False, verbose_name=_('Vertrauenswürdig')) + allows_using_materials = models.CharField(max_length=200,default=ALLOW_USE_MATERIALS_CHOICE[USE_MATERIALS_NOT_ASKED], choices=ALLOW_USE_MATERIALS_CHOICE, verbose_name=_('Erlaubt Nutzung von Inhalten')) location_string = models.CharField(max_length=200, verbose_name=_("Ort der Organisation")) - location = models.ForeignKey(Location, on_delete=models.PROTECT) + location = models.ForeignKey(Location, on_delete=models.PROTECT, blank=True, null=True) instagram = models.URLField(null=True, blank=True, verbose_name=_('Instagram Profil')) facebook = models.URLField(null=True, blank=True, verbose_name=_('Facebook Profil')) fediverse_profile = models.URLField(null=True, blank=True, verbose_name=_('Fediverse Profil'))