feat!: add status to adoption notices, reset migrations because why not
This commit is contained in:
parent
71e69356b8
commit
7210847710
@ -5,7 +5,7 @@ from django.utils.html import format_html
|
|||||||
from .models import User, Language, Text, ReportComment, ReportAdoptionNotice
|
from .models import User, Language, Text, ReportComment, ReportAdoptionNotice
|
||||||
|
|
||||||
from .models import Animal, Species, RescueOrganization, AdoptionNotice, Location, Rule, Image, ModerationAction, \
|
from .models import Animal, Species, RescueOrganization, AdoptionNotice, Location, Rule, Image, ModerationAction, \
|
||||||
Member, Comment, Report, Announcement
|
Member, Comment, Report, Announcement, AdoptionNoticeStatus
|
||||||
|
|
||||||
|
|
||||||
# Define an inline admin descriptor for Employee model
|
# Define an inline admin descriptor for Employee model
|
||||||
@ -21,6 +21,17 @@ class UserAdmin(BaseUserAdmin):
|
|||||||
inlines = [MemberInline]
|
inlines = [MemberInline]
|
||||||
|
|
||||||
|
|
||||||
|
class StatusInline(admin.StackedInline):
|
||||||
|
model = AdoptionNoticeStatus
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(AdoptionNotice)
|
||||||
|
class AdoptionNoticeAdmin(admin.ModelAdmin):
|
||||||
|
inlines = [
|
||||||
|
StatusInline,
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
# Re-register UserAdmin
|
# Re-register UserAdmin
|
||||||
admin.site.register(User, UserAdmin)
|
admin.site.register(User, UserAdmin)
|
||||||
|
|
||||||
@ -56,10 +67,10 @@ admin.site.register(Animal)
|
|||||||
admin.site.register(Species)
|
admin.site.register(Species)
|
||||||
admin.site.register(RescueOrganization)
|
admin.site.register(RescueOrganization)
|
||||||
admin.site.register(Location)
|
admin.site.register(Location)
|
||||||
admin.site.register(AdoptionNotice)
|
|
||||||
admin.site.register(Rule)
|
admin.site.register(Rule)
|
||||||
admin.site.register(Image)
|
admin.site.register(Image)
|
||||||
admin.site.register(ModerationAction)
|
admin.site.register(ModerationAction)
|
||||||
admin.site.register(Language)
|
admin.site.register(Language)
|
||||||
admin.site.register(Text)
|
admin.site.register(Text)
|
||||||
admin.site.register(Announcement)
|
admin.site.register(Announcement)
|
||||||
|
admin.site.register(AdoptionNoticeStatus)
|
||||||
|
@ -4,9 +4,10 @@ from fellchensammlung.models import *
|
|||||||
|
|
||||||
location = Recipe(
|
location = Recipe(
|
||||||
Location,
|
Location,
|
||||||
name=seq('Ort_'),
|
place_id=seq(''),
|
||||||
description=seq('Detaillierte Beschreibung_'),
|
name=seq('Location_'),
|
||||||
postcode=seq("7322"),
|
longitude=seq(""),
|
||||||
|
latitude=seq(""),
|
||||||
)
|
)
|
||||||
|
|
||||||
rescue_org = Recipe(
|
rescue_org = Recipe(
|
||||||
|
@ -35,7 +35,7 @@ class Command(BaseCommand):
|
|||||||
# Check if there already is and AdoptionNotice named Vermittung1TestSalt9227. If it is, the database
|
# Check if there already is and AdoptionNotice named Vermittung1TestSalt9227. If it is, the database
|
||||||
# is already populated and no data will be added again
|
# is already populated and no data will be added again
|
||||||
try:
|
try:
|
||||||
AdoptionNotice.objects.get(name="Vermittung1TestSalt9227")
|
AdoptionNotice.objects.get(name="Vermittlung1TestSalt9227")
|
||||||
print("Database already populated. No additional data will be created")
|
print("Database already populated. No additional data will be created")
|
||||||
return
|
return
|
||||||
except AdoptionNotice.DoesNotExist:
|
except AdoptionNotice.DoesNotExist:
|
||||||
@ -48,7 +48,7 @@ class Command(BaseCommand):
|
|||||||
'fellchensammlung.rescue_org'
|
'fellchensammlung.rescue_org'
|
||||||
)
|
)
|
||||||
|
|
||||||
adoption1 = baker.make(AdoptionNotice, name="Vermittung1TestSalt9227", organization=rescue1)
|
adoption1 = baker.make(AdoptionNotice, name="Vermittlung1TestSalt9227", organization=rescue1)
|
||||||
|
|
||||||
adoption2 = baker.make(AdoptionNotice, name="Vermittung2", organization=rescue2)
|
adoption2 = baker.make(AdoptionNotice, name="Vermittung2", organization=rescue2)
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# Generated by Django 5.0.3 on 2024-04-14 13:57
|
# Generated by Django 5.0.6 on 2024-06-06 16:11
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import django.contrib.auth.models
|
import django.contrib.auth.models
|
||||||
@ -19,6 +19,87 @@ class Migration(migrations.Migration):
|
|||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="AdoptionNotice",
|
||||||
|
fields=[
|
||||||
|
(
|
||||||
|
"id",
|
||||||
|
models.BigAutoField(
|
||||||
|
auto_created=True,
|
||||||
|
primary_key=True,
|
||||||
|
serialize=False,
|
||||||
|
verbose_name="ID",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"created_at",
|
||||||
|
models.DateField(
|
||||||
|
default=datetime.datetime.now, verbose_name="Erstellt am"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"searching_since",
|
||||||
|
models.DateField(verbose_name="Sucht nach einem Zuhause seit"),
|
||||||
|
),
|
||||||
|
("name", models.CharField(max_length=200)),
|
||||||
|
(
|
||||||
|
"description",
|
||||||
|
models.TextField(
|
||||||
|
blank=True, null=True, verbose_name="Beschreibung"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"further_information",
|
||||||
|
models.URLField(
|
||||||
|
blank=True, null=True, verbose_name="Link zu mehr Informationen"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"group_only",
|
||||||
|
models.BooleanField(
|
||||||
|
default=False, verbose_name="Ausschließlich Gruppenadoption"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"location_string",
|
||||||
|
models.CharField(max_length=200, verbose_name="Ortsangabe"),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"permissions": [
|
||||||
|
(
|
||||||
|
"create_active_adoption_notice",
|
||||||
|
"Can create an active adoption notice",
|
||||||
|
)
|
||||||
|
],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="Text",
|
||||||
|
fields=[
|
||||||
|
(
|
||||||
|
"id",
|
||||||
|
models.BigAutoField(
|
||||||
|
auto_created=True,
|
||||||
|
primary_key=True,
|
||||||
|
serialize=False,
|
||||||
|
verbose_name="ID",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("title", models.CharField(max_length=100)),
|
||||||
|
("content", models.TextField(verbose_name="Inhalt")),
|
||||||
|
(
|
||||||
|
"text_code",
|
||||||
|
models.CharField(
|
||||||
|
blank=True, max_length=24, verbose_name="Text code"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"verbose_name": "Text",
|
||||||
|
"verbose_name_plural": "Texte",
|
||||||
|
},
|
||||||
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name="Image",
|
name="Image",
|
||||||
fields=[
|
fields=[
|
||||||
@ -31,7 +112,6 @@ class Migration(migrations.Migration):
|
|||||||
verbose_name="ID",
|
verbose_name="ID",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
("title", models.CharField(max_length=200)),
|
|
||||||
("image", models.ImageField(upload_to="images")),
|
("image", models.ImageField(upload_to="images")),
|
||||||
("alt_text", models.TextField(max_length=2000)),
|
("alt_text", models.TextField(max_length=2000)),
|
||||||
],
|
],
|
||||||
@ -82,26 +162,42 @@ class Migration(migrations.Migration):
|
|||||||
verbose_name="ID",
|
verbose_name="ID",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
("name", models.CharField(max_length=200)),
|
("place_id", models.IntegerField()),
|
||||||
("postcode", models.CharField(max_length=200)),
|
("latitude", models.FloatField()),
|
||||||
|
("longitude", models.FloatField()),
|
||||||
|
("name", models.CharField(max_length=2000)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="Report",
|
||||||
|
fields=[
|
||||||
(
|
(
|
||||||
"country",
|
"id",
|
||||||
|
models.UUIDField(
|
||||||
|
default=uuid.uuid4,
|
||||||
|
help_text="ID dieses reports",
|
||||||
|
primary_key=True,
|
||||||
|
serialize=False,
|
||||||
|
verbose_name="ID",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"status",
|
||||||
models.CharField(
|
models.CharField(
|
||||||
choices=[
|
choices=[
|
||||||
("DE", "Germany"),
|
("action taken", "Action was taken"),
|
||||||
("AT", "Austria"),
|
("no action taken", "No action was taken"),
|
||||||
("CH", "Switzerland"),
|
("waiting", "Waiting for moderator action"),
|
||||||
],
|
],
|
||||||
max_length=20,
|
max_length=30,
|
||||||
),
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"description",
|
|
||||||
models.TextField(
|
|
||||||
blank=True, null=True, verbose_name="Beschreibung"
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
("user_comment", models.TextField(blank=True)),
|
||||||
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
||||||
],
|
],
|
||||||
|
options={
|
||||||
|
"permissions": [],
|
||||||
|
},
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name="Species",
|
name="Species",
|
||||||
@ -244,7 +340,7 @@ class Migration(migrations.Migration):
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name="AdoptionNotice",
|
name="AdoptionNoticeStatus",
|
||||||
fields=[
|
fields=[
|
||||||
(
|
(
|
||||||
"id",
|
"id",
|
||||||
@ -256,47 +352,119 @@ class Migration(migrations.Migration):
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"created_at",
|
"major_status",
|
||||||
models.DateField(
|
models.CharField(
|
||||||
default=datetime.datetime.now, verbose_name="Erstellt am"
|
choices=[
|
||||||
|
("active", "active"),
|
||||||
|
("in_review", "in review"),
|
||||||
|
("closed", "closed"),
|
||||||
|
("disabled", "disabled"),
|
||||||
|
],
|
||||||
|
max_length=200,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"searching_since",
|
"minor_status",
|
||||||
models.DateField(verbose_name="Sucht nach einem Zuhause seit"),
|
models.CharField(
|
||||||
),
|
choices=[
|
||||||
("name", models.CharField(max_length=200)),
|
("searching", "searching"),
|
||||||
(
|
("interested", "interested"),
|
||||||
"description",
|
("waiting_for_review", "waiting_for_review"),
|
||||||
models.TextField(
|
(
|
||||||
blank=True, null=True, verbose_name="Beschreibung"
|
"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,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"further_information",
|
"adoption_notice",
|
||||||
models.URLField(
|
models.OneToOneField(
|
||||||
blank=True, null=True, verbose_name="Link zu mehr Informationen"
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to="fellchensammlung.adoptionnotice",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
(
|
|
||||||
"group_only",
|
|
||||||
models.BooleanField(
|
|
||||||
default=False, verbose_name="Ausschließlich Gruppenadoption"
|
|
||||||
),
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"photos",
|
|
||||||
models.ManyToManyField(blank=True, to="fellchensammlung.image"),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
options={
|
),
|
||||||
"permissions": [
|
migrations.CreateModel(
|
||||||
(
|
name="Announcement",
|
||||||
"create_active_adoption_notice",
|
fields=[
|
||||||
"Can create an active adoption notice",
|
(
|
||||||
)
|
"text_ptr",
|
||||||
],
|
models.OneToOneField(
|
||||||
},
|
auto_created=True,
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
parent_link=True,
|
||||||
|
primary_key=True,
|
||||||
|
serialize=False,
|
||||||
|
to="fellchensammlung.text",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
("logged_in_only", models.BooleanField(default=False)),
|
||||||
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
||||||
|
(
|
||||||
|
"publish_start_time",
|
||||||
|
models.DateTimeField(verbose_name="Veröffentlichungszeitpunk"),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"publish_end_time",
|
||||||
|
models.DateTimeField(verbose_name="Veröffentlichungsende"),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"type",
|
||||||
|
models.CharField(
|
||||||
|
choices=[
|
||||||
|
("important", "important"),
|
||||||
|
("warning", "warning"),
|
||||||
|
("info", "info"),
|
||||||
|
],
|
||||||
|
default="info",
|
||||||
|
max_length=100,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
bases=("fellchensammlung.text",),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="adoptionnotice",
|
||||||
|
name="photos",
|
||||||
|
field=models.ManyToManyField(blank=True, to="fellchensammlung.image"),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="text",
|
||||||
|
name="language",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.PROTECT,
|
||||||
|
to="fellchensammlung.language",
|
||||||
|
verbose_name="Sprache",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="adoptionnotice",
|
||||||
|
name="location",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
on_delete=django.db.models.deletion.SET_NULL,
|
||||||
|
to="fellchensammlung.location",
|
||||||
|
),
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name="Member",
|
name="Member",
|
||||||
@ -348,42 +516,46 @@ class Migration(migrations.Migration):
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name="Report",
|
name="Comment",
|
||||||
fields=[
|
fields=[
|
||||||
(
|
(
|
||||||
"id",
|
"id",
|
||||||
models.UUIDField(
|
models.BigAutoField(
|
||||||
default=uuid.uuid4,
|
auto_created=True,
|
||||||
help_text="ID dieses reports",
|
|
||||||
primary_key=True,
|
primary_key=True,
|
||||||
serialize=False,
|
serialize=False,
|
||||||
verbose_name="ID",
|
verbose_name="ID",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
(
|
|
||||||
"status",
|
|
||||||
models.CharField(
|
|
||||||
choices=[
|
|
||||||
("action taken", "Action was taken"),
|
|
||||||
("no action taken", "No action was taken"),
|
|
||||||
("waiting", "Waiting for moderator action"),
|
|
||||||
],
|
|
||||||
max_length=30,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
("comment", models.TextField(blank=True)),
|
|
||||||
("created_at", models.DateTimeField(auto_now_add=True)),
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
||||||
|
("text", models.TextField(verbose_name="Inhalt")),
|
||||||
(
|
(
|
||||||
"adoption_notice",
|
"adoption_notice",
|
||||||
models.ForeignKey(
|
models.ForeignKey(
|
||||||
on_delete=django.db.models.deletion.CASCADE,
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
to="fellchensammlung.adoptionnotice",
|
to="fellchensammlung.adoptionnotice",
|
||||||
|
verbose_name="AdoptionNotice",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"reply_to",
|
||||||
|
models.ForeignKey(
|
||||||
|
blank=True,
|
||||||
|
null=True,
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to="fellchensammlung.comment",
|
||||||
|
verbose_name="Antwort auf",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"user",
|
||||||
|
models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to="fellchensammlung.member",
|
||||||
|
verbose_name="Nutzer*in",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
options={
|
|
||||||
"permissions": [],
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name="ModerationAction",
|
name="ModerationAction",
|
||||||
@ -439,6 +611,12 @@ class Migration(migrations.Migration):
|
|||||||
"trusted",
|
"trusted",
|
||||||
models.BooleanField(default=False, verbose_name="Vertrauenswürdig"),
|
models.BooleanField(default=False, verbose_name="Vertrauenswürdig"),
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
"location_string",
|
||||||
|
models.CharField(
|
||||||
|
max_length=200, verbose_name="Ort der Organisation"
|
||||||
|
),
|
||||||
|
),
|
||||||
(
|
(
|
||||||
"instagram",
|
"instagram",
|
||||||
models.URLField(
|
models.URLField(
|
||||||
@ -508,7 +686,7 @@ class Migration(migrations.Migration):
|
|||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name="report",
|
model_name="report",
|
||||||
name="reported_broken_rules",
|
name="reported_broken_rules",
|
||||||
field=models.ManyToManyField(blank=True, to="fellchensammlung.rule"),
|
field=models.ManyToManyField(to="fellchensammlung.rule"),
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name="Animal",
|
name="Animal",
|
||||||
@ -563,37 +741,51 @@ class Migration(migrations.Migration):
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name="Text",
|
name="ReportAdoptionNotice",
|
||||||
fields=[
|
fields=[
|
||||||
(
|
(
|
||||||
"id",
|
"report_ptr",
|
||||||
models.BigAutoField(
|
models.OneToOneField(
|
||||||
auto_created=True,
|
auto_created=True,
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
parent_link=True,
|
||||||
primary_key=True,
|
primary_key=True,
|
||||||
serialize=False,
|
serialize=False,
|
||||||
verbose_name="ID",
|
to="fellchensammlung.report",
|
||||||
),
|
|
||||||
),
|
|
||||||
("title", models.CharField(max_length=100)),
|
|
||||||
("content", models.TextField(verbose_name="Inhalt")),
|
|
||||||
(
|
|
||||||
"text_code",
|
|
||||||
models.CharField(
|
|
||||||
blank=True, max_length=24, verbose_name="Text code"
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"language",
|
"adoption_notice",
|
||||||
models.ForeignKey(
|
models.ForeignKey(
|
||||||
on_delete=django.db.models.deletion.PROTECT,
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
to="fellchensammlung.language",
|
to="fellchensammlung.adoptionnotice",
|
||||||
verbose_name="Sprache",
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
options={
|
bases=("fellchensammlung.report",),
|
||||||
"verbose_name": "Text",
|
),
|
||||||
"verbose_name_plural": "Texte",
|
migrations.CreateModel(
|
||||||
},
|
name="ReportComment",
|
||||||
|
fields=[
|
||||||
|
(
|
||||||
|
"report_ptr",
|
||||||
|
models.OneToOneField(
|
||||||
|
auto_created=True,
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
parent_link=True,
|
||||||
|
primary_key=True,
|
||||||
|
serialize=False,
|
||||||
|
to="fellchensammlung.report",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"reported_comment",
|
||||||
|
models.ForeignKey(
|
||||||
|
on_delete=django.db.models.deletion.CASCADE,
|
||||||
|
to="fellchensammlung.comment",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
bases=("fellchensammlung.report",),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
@ -1,56 +0,0 @@
|
|||||||
# Generated by Django 5.0.6 on 2024-06-03 19:22
|
|
||||||
|
|
||||||
import django.db.models.deletion
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
("fellchensammlung", "0001_initial"),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.CreateModel(
|
|
||||||
name="Comment",
|
|
||||||
fields=[
|
|
||||||
(
|
|
||||||
"id",
|
|
||||||
models.BigAutoField(
|
|
||||||
auto_created=True,
|
|
||||||
primary_key=True,
|
|
||||||
serialize=False,
|
|
||||||
verbose_name="ID",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
||||||
("text", models.TextField(verbose_name="Inhalt")),
|
|
||||||
(
|
|
||||||
"adoption_notice",
|
|
||||||
models.ForeignKey(
|
|
||||||
on_delete=django.db.models.deletion.CASCADE,
|
|
||||||
to="fellchensammlung.adoptionnotice",
|
|
||||||
verbose_name="AdoptionNotice",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"reply_to",
|
|
||||||
models.ForeignKey(
|
|
||||||
blank=True,
|
|
||||||
null=True,
|
|
||||||
on_delete=django.db.models.deletion.CASCADE,
|
|
||||||
to="fellchensammlung.comment",
|
|
||||||
verbose_name="Antwort auf",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"user",
|
|
||||||
models.ForeignKey(
|
|
||||||
on_delete=django.db.models.deletion.CASCADE,
|
|
||||||
to="fellchensammlung.member",
|
|
||||||
verbose_name="Nutzer*in",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
]
|
|
@ -1,71 +0,0 @@
|
|||||||
# Generated by Django 5.0.6 on 2024-06-04 06:22
|
|
||||||
|
|
||||||
import django.db.models.deletion
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
("fellchensammlung", "0002_comment"),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.RemoveField(
|
|
||||||
model_name="report",
|
|
||||||
name="adoption_notice",
|
|
||||||
),
|
|
||||||
migrations.RenameField(
|
|
||||||
model_name="report",
|
|
||||||
old_name="comment",
|
|
||||||
new_name="user_comment",
|
|
||||||
),
|
|
||||||
migrations.CreateModel(
|
|
||||||
name="ReportComment",
|
|
||||||
fields=[
|
|
||||||
(
|
|
||||||
"report_ptr",
|
|
||||||
models.OneToOneField(
|
|
||||||
auto_created=True,
|
|
||||||
on_delete=django.db.models.deletion.CASCADE,
|
|
||||||
parent_link=True,
|
|
||||||
primary_key=True,
|
|
||||||
serialize=False,
|
|
||||||
to="fellchensammlung.report",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"reported_comment",
|
|
||||||
models.ForeignKey(
|
|
||||||
on_delete=django.db.models.deletion.CASCADE,
|
|
||||||
to="fellchensammlung.comment",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
bases=("fellchensammlung.report",),
|
|
||||||
),
|
|
||||||
migrations.CreateModel(
|
|
||||||
name="ReportAdoptionNotice",
|
|
||||||
fields=[
|
|
||||||
(
|
|
||||||
"report_ptr",
|
|
||||||
models.OneToOneField(
|
|
||||||
auto_created=True,
|
|
||||||
on_delete=django.db.models.deletion.CASCADE,
|
|
||||||
parent_link=True,
|
|
||||||
primary_key=True,
|
|
||||||
serialize=False,
|
|
||||||
to="fellchensammlung.report",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"adoption_notice",
|
|
||||||
models.ForeignKey(
|
|
||||||
on_delete=django.db.models.deletion.CASCADE,
|
|
||||||
to="fellchensammlung.adoptionnotice",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
bases=("fellchensammlung.report",),
|
|
||||||
),
|
|
||||||
]
|
|
@ -1,18 +0,0 @@
|
|||||||
# Generated by Django 5.0.6 on 2024-06-04 08:40
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
("fellchensammlung", "0003_remove_report_adoption_notice_and_more"),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name="report",
|
|
||||||
name="reported_broken_rules",
|
|
||||||
field=models.ManyToManyField(to="fellchensammlung.rule"),
|
|
||||||
),
|
|
||||||
]
|
|
@ -1,41 +0,0 @@
|
|||||||
# Generated by Django 5.0.6 on 2024-06-05 04:21
|
|
||||||
|
|
||||||
import django.db.models.deletion
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
("fellchensammlung", "0004_alter_report_reported_broken_rules"),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.CreateModel(
|
|
||||||
name="Announcement",
|
|
||||||
fields=[
|
|
||||||
(
|
|
||||||
"text_ptr",
|
|
||||||
models.OneToOneField(
|
|
||||||
auto_created=True,
|
|
||||||
on_delete=django.db.models.deletion.CASCADE,
|
|
||||||
parent_link=True,
|
|
||||||
primary_key=True,
|
|
||||||
serialize=False,
|
|
||||||
to="fellchensammlung.text",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
("logged_in_only", models.BooleanField(default=False)),
|
|
||||||
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
||||||
(
|
|
||||||
"publish_start_time",
|
|
||||||
models.DateTimeField(verbose_name="Veröffentlichungszeitpunk"),
|
|
||||||
),
|
|
||||||
(
|
|
||||||
"publish_end_time",
|
|
||||||
models.DateTimeField(verbose_name="Veröffentlichungsende"),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
bases=("fellchensammlung.text",),
|
|
||||||
),
|
|
||||||
]
|
|
@ -1,26 +0,0 @@
|
|||||||
# Generated by Django 5.0.6 on 2024-06-05 06:21
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
("fellchensammlung", "0005_announcement"),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name="announcement",
|
|
||||||
name="type",
|
|
||||||
field=models.CharField(
|
|
||||||
choices=[
|
|
||||||
("important", "important"),
|
|
||||||
("warning", "warning"),
|
|
||||||
("info", "info"),
|
|
||||||
],
|
|
||||||
default="info",
|
|
||||||
max_length=100,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
]
|
|
@ -1,81 +0,0 @@
|
|||||||
# Generated by Django 5.0.6 on 2024-06-05 13:19
|
|
||||||
|
|
||||||
import django.db.models.deletion
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
("fellchensammlung", "0006_announcement_type"),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.RemoveField(
|
|
||||||
model_name="location",
|
|
||||||
name="country",
|
|
||||||
),
|
|
||||||
migrations.RemoveField(
|
|
||||||
model_name="location",
|
|
||||||
name="description",
|
|
||||||
),
|
|
||||||
migrations.RemoveField(
|
|
||||||
model_name="location",
|
|
||||||
name="postcode",
|
|
||||||
),
|
|
||||||
migrations.AddField(
|
|
||||||
model_name="adoptionnotice",
|
|
||||||
name="location",
|
|
||||||
field=models.ForeignKey(
|
|
||||||
blank=True,
|
|
||||||
null=True,
|
|
||||||
on_delete=django.db.models.deletion.SET_NULL,
|
|
||||||
to="fellchensammlung.location",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
migrations.AddField(
|
|
||||||
model_name="adoptionnotice",
|
|
||||||
name="location_string",
|
|
||||||
field=models.CharField(
|
|
||||||
default="72072", max_length=200, verbose_name="Ortsangabe"
|
|
||||||
),
|
|
||||||
preserve_default=False,
|
|
||||||
),
|
|
||||||
migrations.AddField(
|
|
||||||
model_name="location",
|
|
||||||
name="latitude",
|
|
||||||
field=models.FloatField(default=47),
|
|
||||||
preserve_default=False,
|
|
||||||
),
|
|
||||||
migrations.AddField(
|
|
||||||
model_name="location",
|
|
||||||
name="longitude",
|
|
||||||
field=models.FloatField(default=9),
|
|
||||||
preserve_default=False,
|
|
||||||
),
|
|
||||||
migrations.AddField(
|
|
||||||
model_name="location",
|
|
||||||
name="osm_id",
|
|
||||||
field=models.IntegerField(default=1),
|
|
||||||
preserve_default=False,
|
|
||||||
),
|
|
||||||
migrations.AddField(
|
|
||||||
model_name="location",
|
|
||||||
name="place_id",
|
|
||||||
field=models.IntegerField(default=1),
|
|
||||||
preserve_default=False,
|
|
||||||
),
|
|
||||||
migrations.AddField(
|
|
||||||
model_name="rescueorganization",
|
|
||||||
name="location_string",
|
|
||||||
field=models.CharField(
|
|
||||||
default="72072", max_length=200, verbose_name="Ort der Organisation"
|
|
||||||
),
|
|
||||||
preserve_default=False,
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name="location",
|
|
||||||
name="name",
|
|
||||||
field=models.CharField(max_length=2000),
|
|
||||||
),
|
|
||||||
]
|
|
@ -1,20 +0,0 @@
|
|||||||
# Generated by Django 5.0.6 on 2024-06-05 19:52
|
|
||||||
|
|
||||||
from django.db import migrations
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
(
|
|
||||||
"fellchensammlung",
|
|
||||||
"0007_remove_location_country_remove_location_description_and_more",
|
|
||||||
),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.RemoveField(
|
|
||||||
model_name="location",
|
|
||||||
name="osm_id",
|
|
||||||
),
|
|
||||||
]
|
|
@ -1,17 +0,0 @@
|
|||||||
# Generated by Django 5.0.6 on 2024-06-06 08:48
|
|
||||||
|
|
||||||
from django.db import migrations
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
("fellchensammlung", "0008_remove_location_osm_id"),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.RemoveField(
|
|
||||||
model_name="image",
|
|
||||||
name="title",
|
|
||||||
),
|
|
||||||
]
|
|
@ -1,70 +0,0 @@
|
|||||||
# 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,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
]
|
|
@ -1,27 +0,0 @@
|
|||||||
# 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,
|
|
||||||
),
|
|
||||||
]
|
|
@ -35,64 +35,6 @@ class Language(models.Model):
|
|||||||
verbose_name_plural = _('Sprachen')
|
verbose_name_plural = _('Sprachen')
|
||||||
|
|
||||||
|
|
||||||
class Status(models.Model):
|
|
||||||
"""
|
|
||||||
The major status indicates a general state of an adoption notice
|
|
||||||
whereas the minor status is used for reporting
|
|
||||||
"""
|
|
||||||
|
|
||||||
ACTIVE = "active"
|
|
||||||
IN_REVIEW = "in_review"
|
|
||||||
CLOSED = "closed"
|
|
||||||
DISABLED = "disabled"
|
|
||||||
MAJOR_STATUS_CHOICES = {
|
|
||||||
ACTIVE: "active",
|
|
||||||
IN_REVIEW: "in review",
|
|
||||||
CLOSED: "closed",
|
|
||||||
DISABLED: "disabled",
|
|
||||||
}
|
|
||||||
|
|
||||||
MINOR_STATUS_CHOICES = {
|
|
||||||
ACTIVE: {
|
|
||||||
"searching": "searching",
|
|
||||||
"interested": "interested",
|
|
||||||
},
|
|
||||||
IN_REVIEW: {
|
|
||||||
"waiting_for_review": "waiting_for_review",
|
|
||||||
},
|
|
||||||
CLOSED: {
|
|
||||||
"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"
|
|
||||||
},
|
|
||||||
DISABLED: {
|
|
||||||
"against_the_rules": "against_the_rules",
|
|
||||||
"missing_information": "missing_information",
|
|
||||||
"other": "other"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
major_status = models.CharField(choices=MAJOR_STATUS_CHOICES, max_length=200)
|
|
||||||
minor_choices = {}
|
|
||||||
for key in MINOR_STATUS_CHOICES:
|
|
||||||
minor_choices.update(MINOR_STATUS_CHOICES[key])
|
|
||||||
minor_status = models.CharField(choices=minor_choices, max_length=200)
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
return f"{self.major_status}: {self.minor_status}"
|
|
||||||
|
|
||||||
@property
|
|
||||||
def is_active(self):
|
|
||||||
return self.major_status == self.ACTIVE
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_minor_choices(major_status):
|
|
||||||
return Status.MINOR_STATUS_CHOICES[major_status]
|
|
||||||
|
|
||||||
|
|
||||||
class Image(models.Model):
|
class Image(models.Model):
|
||||||
image = models.ImageField(upload_to='images')
|
image = models.ImageField(upload_to='images')
|
||||||
alt_text = models.TextField(max_length=2000)
|
alt_text = models.TextField(max_length=2000)
|
||||||
@ -182,7 +124,6 @@ class AdoptionNotice(models.Model):
|
|||||||
photos = models.ManyToManyField(Image, blank=True)
|
photos = models.ManyToManyField(Image, blank=True)
|
||||||
location_string = models.CharField(max_length=200, verbose_name=_("Ortsangabe"))
|
location_string = models.CharField(max_length=200, verbose_name=_("Ortsangabe"))
|
||||||
location = models.ForeignKey(Location, blank=True, null=True, on_delete=models.SET_NULL, )
|
location = models.ForeignKey(Location, blank=True, null=True, on_delete=models.SET_NULL, )
|
||||||
status = models.ForeignKey(Status, on_delete=models.PROTECT)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def animals(self):
|
def animals(self):
|
||||||
@ -258,7 +199,69 @@ class AdoptionNotice(models.Model):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def is_active(self):
|
def is_active(self):
|
||||||
return self.status.is_active
|
if not hasattr(self, 'adoptionnoticestatus'):
|
||||||
|
return False
|
||||||
|
return self.adoptionnoticestatus.is_active
|
||||||
|
|
||||||
|
|
||||||
|
class AdoptionNoticeStatus(models.Model):
|
||||||
|
"""
|
||||||
|
The major status indicates a general state of an adoption notice
|
||||||
|
whereas the minor status is used for reporting
|
||||||
|
"""
|
||||||
|
|
||||||
|
ACTIVE = "active"
|
||||||
|
IN_REVIEW = "in_review"
|
||||||
|
CLOSED = "closed"
|
||||||
|
DISABLED = "disabled"
|
||||||
|
MAJOR_STATUS_CHOICES = {
|
||||||
|
ACTIVE: "active",
|
||||||
|
IN_REVIEW: "in review",
|
||||||
|
CLOSED: "closed",
|
||||||
|
DISABLED: "disabled",
|
||||||
|
}
|
||||||
|
|
||||||
|
MINOR_STATUS_CHOICES = {
|
||||||
|
ACTIVE: {
|
||||||
|
"searching": "searching",
|
||||||
|
"interested": "interested",
|
||||||
|
},
|
||||||
|
IN_REVIEW: {
|
||||||
|
"waiting_for_review": "waiting_for_review",
|
||||||
|
},
|
||||||
|
CLOSED: {
|
||||||
|
"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"
|
||||||
|
},
|
||||||
|
DISABLED: {
|
||||||
|
"against_the_rules": "against_the_rules",
|
||||||
|
"missing_information": "missing_information",
|
||||||
|
"technical_error": "technical_error",
|
||||||
|
"other": "other"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
major_status = models.CharField(choices=MAJOR_STATUS_CHOICES, max_length=200)
|
||||||
|
minor_choices = {}
|
||||||
|
for key in MINOR_STATUS_CHOICES:
|
||||||
|
minor_choices.update(MINOR_STATUS_CHOICES[key])
|
||||||
|
minor_status = models.CharField(choices=minor_choices, max_length=200)
|
||||||
|
adoption_notice = models.OneToOneField(AdoptionNotice, on_delete=models.CASCADE)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return f"{self.adoption_notice}: {self.major_status}, {self.minor_status}"
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_active(self):
|
||||||
|
return self.major_status == self.ACTIVE
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_minor_choices(major_status):
|
||||||
|
return AdoptionNoticeStatus.MINOR_STATUS_CHOICES[major_status]
|
||||||
|
|
||||||
|
|
||||||
class Animal(models.Model):
|
class Animal(models.Model):
|
||||||
|
Loading…
Reference in New Issue
Block a user