From 294c790234a8212f083b44a0ee51cf1171a5ea06 Mon Sep 17 00:00:00 2001 From: gw3000 Date: Thu, 8 Jun 2023 18:02:06 +0200 Subject: [PATCH] rescuers added --- core/settings.py | 1 + fbf/migrations/0001_initial.py | 47 ++- fbf/migrations/0002_fallenbird.py | 48 --- fbf/models.py | 2 + fixtures/data.json | 509 +---------------------------- rescuer/__init__.py | 0 rescuer/admin.py | 17 + rescuer/apps.py | 6 + rescuer/migrations/0001_initial.py | 64 ++++ rescuer/migrations/__init__.py | 0 rescuer/models.py | 31 ++ rescuer/tests.py | 3 + rescuer/views.py | 3 + 13 files changed, 173 insertions(+), 558 deletions(-) delete mode 100644 fbf/migrations/0002_fallenbird.py create mode 100644 rescuer/__init__.py create mode 100644 rescuer/admin.py create mode 100644 rescuer/apps.py create mode 100644 rescuer/migrations/0001_initial.py create mode 100644 rescuer/migrations/__init__.py create mode 100644 rescuer/models.py create mode 100644 rescuer/tests.py create mode 100644 rescuer/views.py diff --git a/core/settings.py b/core/settings.py index 30d2520..ca4703c 100644 --- a/core/settings.py +++ b/core/settings.py @@ -40,6 +40,7 @@ INSTALLED_APPS = [ # my apps "sites", "fbf", + "rescuer", ] MIDDLEWARE = [ diff --git a/fbf/migrations/0001_initial.py b/fbf/migrations/0001_initial.py index 88f3221..5743e89 100644 --- a/fbf/migrations/0001_initial.py +++ b/fbf/migrations/0001_initial.py @@ -1,6 +1,8 @@ -# Generated by Django 4.2.2 on 2023-06-06 17:33 +# Generated by Django 4.2.2 on 2023-06-08 15:45 +from django.conf import settings from django.db import migrations, models +import django.db.models.deletion import uuid @@ -8,7 +10,10 @@ class Migration(migrations.Migration): initial = True - dependencies = [] + dependencies = [ + ("rescuer", "0001_initial"), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] operations = [ migrations.CreateModel( @@ -26,4 +31,42 @@ class Migration(migrations.Migration): ("name", models.CharField(max_length=256)), ], ), + migrations.CreateModel( + name="FallenBird", + fields=[ + ( + "id", + models.UUIDField( + default=uuid.uuid4, + editable=False, + primary_key=True, + serialize=False, + ), + ), + ("date_found", models.DateTimeField()), + ("place", models.CharField(max_length=256)), + ("created", models.DateTimeField(auto_now_add=True)), + ("updated", models.DateTimeField(auto_now=True)), + ( + "bird", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, to="fbf.bird" + ), + ), + ( + "rescuer", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to="rescuer.rescuer", + ), + ), + ( + "user", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to=settings.AUTH_USER_MODEL, + ), + ), + ], + ), ] diff --git a/fbf/migrations/0002_fallenbird.py b/fbf/migrations/0002_fallenbird.py deleted file mode 100644 index 4d22b55..0000000 --- a/fbf/migrations/0002_fallenbird.py +++ /dev/null @@ -1,48 +0,0 @@ -# Generated by Django 4.2.2 on 2023-06-06 18:30 - -from django.conf import settings -from django.db import migrations, models -import django.db.models.deletion -import uuid - - -class Migration(migrations.Migration): - - dependencies = [ - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ("fbf", "0001_initial"), - ] - - operations = [ - migrations.CreateModel( - name="FallenBird", - fields=[ - ( - "id", - models.UUIDField( - default=uuid.uuid4, - editable=False, - primary_key=True, - serialize=False, - ), - ), - ("date_found", models.DateTimeField()), - ("place", models.CharField(max_length=256)), - ("created", models.DateTimeField(auto_now_add=True)), - ("updated", models.DateTimeField(auto_now=True)), - ( - "bird", - models.ForeignKey( - on_delete=django.db.models.deletion.CASCADE, to="fbf.bird" - ), - ), - ( - "user", - models.ForeignKey( - on_delete=django.db.models.deletion.CASCADE, - to=settings.AUTH_USER_MODEL, - ), - ), - ], - ), - ] diff --git a/fbf/models.py b/fbf/models.py index 4f4ab2b..adba9cf 100644 --- a/fbf/models.py +++ b/fbf/models.py @@ -1,6 +1,7 @@ from django.db import models from django.conf import settings from uuid import uuid4 +from rescuer.models import Rescuer class FallenBird(models.Model): @@ -10,6 +11,7 @@ class FallenBird(models.Model): place = models.CharField(max_length=256) created = models.DateTimeField(auto_now_add=True) updated = models.DateTimeField(auto_now=True) + rescuer = models.ForeignKey(Rescuer, on_delete=models.CASCADE) user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) def __str__(self): diff --git a/fixtures/data.json b/fixtures/data.json index 855ea8b..78e58d3 100644 --- a/fixtures/data.json +++ b/fixtures/data.json @@ -1,508 +1 @@ -[ - { - "model": "admin.logentry", - "pk": 1, - "fields": { - "action_time": "2023-06-06T18:32:18.420Z", - "user": 1, - "content_type": 7, - "object_id": "66f1f248-234f-42a7-ad7c-ddfcb1047345", - "object_repr": "Amsel", - "action_flag": 1, - "change_message": "[{\"added\": {}}]" - } - }, - { - "model": "admin.logentry", - "pk": 2, - "fields": { - "action_time": "2023-06-06T18:36:50.824Z", - "user": 1, - "content_type": 8, - "object_id": "4b8ca0c6-d4ff-4279-8058-247c69fd7b47", - "object_repr": "d", - "action_flag": 1, - "change_message": "[{\"added\": {}}]" - } - }, - { - "model": "admin.logentry", - "pk": 3, - "fields": { - "action_time": "2023-06-06T18:37:26.630Z", - "user": 1, - "content_type": 8, - "object_id": "4b8ca0c6-d4ff-4279-8058-247c69fd7b47", - "object_repr": "Arvid-Harnack-Straße 22", - "action_flag": 2, - "change_message": "[{\"changed\": {\"fields\": [\"Place\"]}}]" - } - }, - { - "model": "admin.logentry", - "pk": 4, - "fields": { - "action_time": "2023-06-06T18:37:50.414Z", - "user": 1, - "content_type": 7, - "object_id": "3fd4f7b9-4860-4ee8-94a3-313d5bb67a77", - "object_repr": "Kohlmeise", - "action_flag": 1, - "change_message": "[{\"added\": {}}]" - } - }, - { - "model": "admin.logentry", - "pk": 5, - "fields": { - "action_time": "2023-06-06T18:38:08.262Z", - "user": 1, - "content_type": 8, - "object_id": "3f28e67c-61be-403b-9753-eeb26bd04ca6", - "object_repr": "Käthe Kollwitz Strae 16", - "action_flag": 1, - "change_message": "[{\"added\": {}}]" - } - }, - { - "model": "admin.logentry", - "pk": 6, - "fields": { - "action_time": "2023-06-06T18:38:43.227Z", - "user": 1, - "content_type": 8, - "object_id": "28cce914-0cb3-4854-991c-24b65eefafb7", - "object_repr": "Am Planetarium 2", - "action_flag": 1, - "change_message": "[{\"added\": {}}]" - } - }, - { - "model": "auth.permission", - "pk": 1, - "fields": { - "name": "Can add log entry", - "content_type": 1, - "codename": "add_logentry" - } - }, - { - "model": "auth.permission", - "pk": 2, - "fields": { - "name": "Can change log entry", - "content_type": 1, - "codename": "change_logentry" - } - }, - { - "model": "auth.permission", - "pk": 3, - "fields": { - "name": "Can delete log entry", - "content_type": 1, - "codename": "delete_logentry" - } - }, - { - "model": "auth.permission", - "pk": 4, - "fields": { - "name": "Can view log entry", - "content_type": 1, - "codename": "view_logentry" - } - }, - { - "model": "auth.permission", - "pk": 5, - "fields": { - "name": "Can add permission", - "content_type": 2, - "codename": "add_permission" - } - }, - { - "model": "auth.permission", - "pk": 6, - "fields": { - "name": "Can change permission", - "content_type": 2, - "codename": "change_permission" - } - }, - { - "model": "auth.permission", - "pk": 7, - "fields": { - "name": "Can delete permission", - "content_type": 2, - "codename": "delete_permission" - } - }, - { - "model": "auth.permission", - "pk": 8, - "fields": { - "name": "Can view permission", - "content_type": 2, - "codename": "view_permission" - } - }, - { - "model": "auth.permission", - "pk": 9, - "fields": { - "name": "Can add group", - "content_type": 3, - "codename": "add_group" - } - }, - { - "model": "auth.permission", - "pk": 10, - "fields": { - "name": "Can change group", - "content_type": 3, - "codename": "change_group" - } - }, - { - "model": "auth.permission", - "pk": 11, - "fields": { - "name": "Can delete group", - "content_type": 3, - "codename": "delete_group" - } - }, - { - "model": "auth.permission", - "pk": 12, - "fields": { - "name": "Can view group", - "content_type": 3, - "codename": "view_group" - } - }, - { - "model": "auth.permission", - "pk": 13, - "fields": { - "name": "Can add user", - "content_type": 4, - "codename": "add_user" - } - }, - { - "model": "auth.permission", - "pk": 14, - "fields": { - "name": "Can change user", - "content_type": 4, - "codename": "change_user" - } - }, - { - "model": "auth.permission", - "pk": 15, - "fields": { - "name": "Can delete user", - "content_type": 4, - "codename": "delete_user" - } - }, - { - "model": "auth.permission", - "pk": 16, - "fields": { - "name": "Can view user", - "content_type": 4, - "codename": "view_user" - } - }, - { - "model": "auth.permission", - "pk": 17, - "fields": { - "name": "Can add content type", - "content_type": 5, - "codename": "add_contenttype" - } - }, - { - "model": "auth.permission", - "pk": 18, - "fields": { - "name": "Can change content type", - "content_type": 5, - "codename": "change_contenttype" - } - }, - { - "model": "auth.permission", - "pk": 19, - "fields": { - "name": "Can delete content type", - "content_type": 5, - "codename": "delete_contenttype" - } - }, - { - "model": "auth.permission", - "pk": 20, - "fields": { - "name": "Can view content type", - "content_type": 5, - "codename": "view_contenttype" - } - }, - { - "model": "auth.permission", - "pk": 21, - "fields": { - "name": "Can add session", - "content_type": 6, - "codename": "add_session" - } - }, - { - "model": "auth.permission", - "pk": 22, - "fields": { - "name": "Can change session", - "content_type": 6, - "codename": "change_session" - } - }, - { - "model": "auth.permission", - "pk": 23, - "fields": { - "name": "Can delete session", - "content_type": 6, - "codename": "delete_session" - } - }, - { - "model": "auth.permission", - "pk": 24, - "fields": { - "name": "Can view session", - "content_type": 6, - "codename": "view_session" - } - }, - { - "model": "auth.permission", - "pk": 25, - "fields": { - "name": "Can add bird", - "content_type": 7, - "codename": "add_bird" - } - }, - { - "model": "auth.permission", - "pk": 26, - "fields": { - "name": "Can change bird", - "content_type": 7, - "codename": "change_bird" - } - }, - { - "model": "auth.permission", - "pk": 27, - "fields": { - "name": "Can delete bird", - "content_type": 7, - "codename": "delete_bird" - } - }, - { - "model": "auth.permission", - "pk": 28, - "fields": { - "name": "Can view bird", - "content_type": 7, - "codename": "view_bird" - } - }, - { - "model": "auth.permission", - "pk": 29, - "fields": { - "name": "Can add fallen bird", - "content_type": 8, - "codename": "add_fallenbird" - } - }, - { - "model": "auth.permission", - "pk": 30, - "fields": { - "name": "Can change fallen bird", - "content_type": 8, - "codename": "change_fallenbird" - } - }, - { - "model": "auth.permission", - "pk": 31, - "fields": { - "name": "Can delete fallen bird", - "content_type": 8, - "codename": "delete_fallenbird" - } - }, - { - "model": "auth.permission", - "pk": 32, - "fields": { - "name": "Can view fallen bird", - "content_type": 8, - "codename": "view_fallenbird" - } - }, - { - "model": "auth.user", - "pk": 1, - "fields": { - "password": "pbkdf2_sha256$600000$98NYQuoflsx9NAAIfINy5i$m2IPXxTPP6+teSgT2t2YsYGeXnFbHRhoq/iq/MIcjwE=", - "last_login": "2023-06-06T18:32:07.835Z", - "is_superuser": true, - "username": "gw", - "first_name": "", - "last_name": "", - "email": "gw@email.de", - "is_staff": true, - "is_active": true, - "date_joined": "2023-06-06T18:31:57.718Z", - "groups": [], - "user_permissions": [] - } - }, - { - "model": "contenttypes.contenttype", - "pk": 1, - "fields": { - "app_label": "admin", - "model": "logentry" - } - }, - { - "model": "contenttypes.contenttype", - "pk": 2, - "fields": { - "app_label": "auth", - "model": "permission" - } - }, - { - "model": "contenttypes.contenttype", - "pk": 3, - "fields": { - "app_label": "auth", - "model": "group" - } - }, - { - "model": "contenttypes.contenttype", - "pk": 4, - "fields": { - "app_label": "auth", - "model": "user" - } - }, - { - "model": "contenttypes.contenttype", - "pk": 5, - "fields": { - "app_label": "contenttypes", - "model": "contenttype" - } - }, - { - "model": "contenttypes.contenttype", - "pk": 6, - "fields": { - "app_label": "sessions", - "model": "session" - } - }, - { - "model": "contenttypes.contenttype", - "pk": 7, - "fields": { - "app_label": "fbf", - "model": "bird" - } - }, - { - "model": "contenttypes.contenttype", - "pk": 8, - "fields": { - "app_label": "fbf", - "model": "fallenbird" - } - }, - { - "model": "sessions.session", - "pk": "osw0aaz4116vgj847qd8zbbbd675i8ep", - "fields": { - "session_data": ".eJxVjDsOwjAQBe_iGllZb-zYlPScIdqPjQMokfKpEHeHSCmgfTPzXqanba39tuS5H9ScDZjT78YkjzzuQO803iYr07jOA9tdsQdd7HXS_Lwc7t9BpaV-axddEUiQVIJKcdpgRHHg2tZ3LWQvLIUICTh79KFjBsXcIFAKMbB5fwDjYjfq:1q6bTT:r1SB05Cta7bBmaR9US9J6bxPuTDnQETrEgf8MMWfCTk", - "expire_date": "2023-06-20T18:32:07.836Z" - } - }, - { - "model": "fbf.fallenbird", - "pk": "28cce914-0cb3-4854-991c-24b65eefafb7", - "fields": { - "bird": "66f1f248-234f-42a7-ad7c-ddfcb1047345", - "date_found": "2023-06-06T18:38:34Z", - "place": "Am Planetarium 2", - "created": "2023-06-06T18:38:43.225Z", - "updated": "2023-06-06T18:38:43.225Z", - "user": 1 - } - }, - { - "model": "fbf.fallenbird", - "pk": "3f28e67c-61be-403b-9753-eeb26bd04ca6", - "fields": { - "bird": "3fd4f7b9-4860-4ee8-94a3-313d5bb67a77", - "date_found": "2023-06-06T18:37:54Z", - "place": "Käthe Kollwitz Strae 16", - "created": "2023-06-06T18:38:08.260Z", - "updated": "2023-06-06T18:38:08.260Z", - "user": 1 - } - }, - { - "model": "fbf.fallenbird", - "pk": "4b8ca0c6-d4ff-4279-8058-247c69fd7b47", - "fields": { - "bird": "66f1f248-234f-42a7-ad7c-ddfcb1047345", - "date_found": "2023-06-06T18:36:09Z", - "place": "Arvid-Harnack-Straße 22", - "created": "2023-06-06T18:36:50.822Z", - "updated": "2023-06-06T18:37:26.627Z", - "user": 1 - } - }, - { - "model": "fbf.bird", - "pk": "3fd4f7b9-4860-4ee8-94a3-313d5bb67a77", - "fields": { - "name": "Kohlmeise" - } - }, - { - "model": "fbf.bird", - "pk": "66f1f248-234f-42a7-ad7c-ddfcb1047345", - "fields": { - "name": "Amsel" - } - } -] \ No newline at end of file +[{"model": "admin.logentry", "pk": 1, "fields": {"action_time": "2023-06-08T15:45:49.159Z", "user": 1, "content_type": 7, "object_id": "3b67f940-44f7-439d-9521-87790a860b62", "object_repr": "Amsel", "action_flag": 1, "change_message": "[{\"added\": {}}]"}}, {"model": "admin.logentry", "pk": 2, "fields": {"action_time": "2023-06-08T15:46:22.296Z", "user": 1, "content_type": 9, "object_id": "cbcd37de-c931-42e2-8fc8-0cd4a7e917f9", "object_repr": "Gunther Weißenbäck", "action_flag": 1, "change_message": "[{\"added\": {}}]"}}, {"model": "admin.logentry", "pk": 3, "fields": {"action_time": "2023-06-08T15:46:49.293Z", "user": 1, "content_type": 8, "object_id": "d4355c8c-4683-4b01-bc50-0e5045d12a9d", "object_repr": "Arvid-Harnack-Straße 22", "action_flag": 1, "change_message": "[{\"added\": {}}]"}}, {"model": "admin.logentry", "pk": 4, "fields": {"action_time": "2023-06-08T15:47:13.572Z", "user": 1, "content_type": 7, "object_id": "2650f644-b558-4cad-be0a-c7c25b3b97ed", "object_repr": "Kohlmeise", "action_flag": 1, "change_message": "[{\"added\": {}}]"}}, {"model": "admin.logentry", "pk": 5, "fields": {"action_time": "2023-06-08T15:47:40.186Z", "user": 1, "content_type": 8, "object_id": "202c30db-ee42-4922-8524-5d335e813b19", "object_repr": "Käthe Kollwitz Strae 16", "action_flag": 1, "change_message": "[{\"added\": {}}]"}}, {"model": "admin.logentry", "pk": 6, "fields": {"action_time": "2023-06-08T15:57:34.370Z", "user": 1, "content_type": 9, "object_id": "afff90af-890d-4130-ada6-4ad5c65ed51b", "object_repr": "Cornelia Weißenbäck", "action_flag": 1, "change_message": "[{\"added\": {}}]"}}, {"model": "admin.logentry", "pk": 7, "fields": {"action_time": "2023-06-08T15:57:47.601Z", "user": 1, "content_type": 9, "object_id": "cbcd37de-c931-42e2-8fc8-0cd4a7e917f9", "object_repr": "Gunther Weißenbäck", "action_flag": 2, "change_message": "[{\"changed\": {\"fields\": [\"Email\"]}}]"}}, {"model": "admin.logentry", "pk": 8, "fields": {"action_time": "2023-06-08T15:58:31.101Z", "user": 1, "content_type": 9, "object_id": "cbcd37de-c931-42e2-8fc8-0cd4a7e917f9", "object_repr": "Jim Henson", "action_flag": 2, "change_message": "[{\"changed\": {\"fields\": [\"First name\", \"Last name\", \"Street\", \"Street number\", \"Email\"]}}]"}}, {"model": "admin.logentry", "pk": 9, "fields": {"action_time": "2023-06-08T15:59:10.082Z", "user": 1, "content_type": 9, "object_id": "afff90af-890d-4130-ada6-4ad5c65ed51b", "object_repr": "Liz Taylor", "action_flag": 2, "change_message": "[{\"changed\": {\"fields\": [\"Gender\", \"First name\", \"Last name\", \"Street\", \"Street number\", \"Date of birth\", \"Email\"]}}]"}}, {"model": "auth.permission", "pk": 1, "fields": {"name": "Can add log entry", "content_type": 1, "codename": "add_logentry"}}, {"model": "auth.permission", "pk": 2, "fields": {"name": "Can change log entry", "content_type": 1, "codename": "change_logentry"}}, {"model": "auth.permission", "pk": 3, "fields": {"name": "Can delete log entry", "content_type": 1, "codename": "delete_logentry"}}, {"model": "auth.permission", "pk": 4, "fields": {"name": "Can view log entry", "content_type": 1, "codename": "view_logentry"}}, {"model": "auth.permission", "pk": 5, "fields": {"name": "Can add permission", "content_type": 2, "codename": "add_permission"}}, {"model": "auth.permission", "pk": 6, "fields": {"name": "Can change permission", "content_type": 2, "codename": "change_permission"}}, {"model": "auth.permission", "pk": 7, "fields": {"name": "Can delete permission", "content_type": 2, "codename": "delete_permission"}}, {"model": "auth.permission", "pk": 8, "fields": {"name": "Can view permission", "content_type": 2, "codename": "view_permission"}}, {"model": "auth.permission", "pk": 9, "fields": {"name": "Can add group", "content_type": 3, "codename": "add_group"}}, {"model": "auth.permission", "pk": 10, "fields": {"name": "Can change group", "content_type": 3, "codename": "change_group"}}, {"model": "auth.permission", "pk": 11, "fields": {"name": "Can delete group", "content_type": 3, "codename": "delete_group"}}, {"model": "auth.permission", "pk": 12, "fields": {"name": "Can view group", "content_type": 3, "codename": "view_group"}}, {"model": "auth.permission", "pk": 13, "fields": {"name": "Can add user", "content_type": 4, "codename": "add_user"}}, {"model": "auth.permission", "pk": 14, "fields": {"name": "Can change user", "content_type": 4, "codename": "change_user"}}, {"model": "auth.permission", "pk": 15, "fields": {"name": "Can delete user", "content_type": 4, "codename": "delete_user"}}, {"model": "auth.permission", "pk": 16, "fields": {"name": "Can view user", "content_type": 4, "codename": "view_user"}}, {"model": "auth.permission", "pk": 17, "fields": {"name": "Can add content type", "content_type": 5, "codename": "add_contenttype"}}, {"model": "auth.permission", "pk": 18, "fields": {"name": "Can change content type", "content_type": 5, "codename": "change_contenttype"}}, {"model": "auth.permission", "pk": 19, "fields": {"name": "Can delete content type", "content_type": 5, "codename": "delete_contenttype"}}, {"model": "auth.permission", "pk": 20, "fields": {"name": "Can view content type", "content_type": 5, "codename": "view_contenttype"}}, {"model": "auth.permission", "pk": 21, "fields": {"name": "Can add session", "content_type": 6, "codename": "add_session"}}, {"model": "auth.permission", "pk": 22, "fields": {"name": "Can change session", "content_type": 6, "codename": "change_session"}}, {"model": "auth.permission", "pk": 23, "fields": {"name": "Can delete session", "content_type": 6, "codename": "delete_session"}}, {"model": "auth.permission", "pk": 24, "fields": {"name": "Can view session", "content_type": 6, "codename": "view_session"}}, {"model": "auth.permission", "pk": 25, "fields": {"name": "Can add bird", "content_type": 7, "codename": "add_bird"}}, {"model": "auth.permission", "pk": 26, "fields": {"name": "Can change bird", "content_type": 7, "codename": "change_bird"}}, {"model": "auth.permission", "pk": 27, "fields": {"name": "Can delete bird", "content_type": 7, "codename": "delete_bird"}}, {"model": "auth.permission", "pk": 28, "fields": {"name": "Can view bird", "content_type": 7, "codename": "view_bird"}}, {"model": "auth.permission", "pk": 29, "fields": {"name": "Can add fallen bird", "content_type": 8, "codename": "add_fallenbird"}}, {"model": "auth.permission", "pk": 30, "fields": {"name": "Can change fallen bird", "content_type": 8, "codename": "change_fallenbird"}}, {"model": "auth.permission", "pk": 31, "fields": {"name": "Can delete fallen bird", "content_type": 8, "codename": "delete_fallenbird"}}, {"model": "auth.permission", "pk": 32, "fields": {"name": "Can view fallen bird", "content_type": 8, "codename": "view_fallenbird"}}, {"model": "auth.permission", "pk": 33, "fields": {"name": "Can add rescuer", "content_type": 9, "codename": "add_rescuer"}}, {"model": "auth.permission", "pk": 34, "fields": {"name": "Can change rescuer", "content_type": 9, "codename": "change_rescuer"}}, {"model": "auth.permission", "pk": 35, "fields": {"name": "Can delete rescuer", "content_type": 9, "codename": "delete_rescuer"}}, {"model": "auth.permission", "pk": 36, "fields": {"name": "Can view rescuer", "content_type": 9, "codename": "view_rescuer"}}, {"model": "auth.user", "pk": 1, "fields": {"password": "pbkdf2_sha256$600000$XQOfnqaWQfJyH689bGOpDn$aQ2PUHaroeIo3UVh1uZG/TMjbpiNzSZejECqnJ3Zynk=", "last_login": "2023-06-08T16:00:26.339Z", "is_superuser": true, "username": "gw", "first_name": "", "last_name": "", "email": "gw@email.de", "is_staff": true, "is_active": true, "date_joined": "2023-06-08T15:45:25.573Z", "groups": [], "user_permissions": []}}, {"model": "contenttypes.contenttype", "pk": 1, "fields": {"app_label": "admin", "model": "logentry"}}, {"model": "contenttypes.contenttype", "pk": 2, "fields": {"app_label": "auth", "model": "permission"}}, {"model": "contenttypes.contenttype", "pk": 3, "fields": {"app_label": "auth", "model": "group"}}, {"model": "contenttypes.contenttype", "pk": 4, "fields": {"app_label": "auth", "model": "user"}}, {"model": "contenttypes.contenttype", "pk": 5, "fields": {"app_label": "contenttypes", "model": "contenttype"}}, {"model": "contenttypes.contenttype", "pk": 6, "fields": {"app_label": "sessions", "model": "session"}}, {"model": "contenttypes.contenttype", "pk": 7, "fields": {"app_label": "fbf", "model": "bird"}}, {"model": "contenttypes.contenttype", "pk": 8, "fields": {"app_label": "fbf", "model": "fallenbird"}}, {"model": "contenttypes.contenttype", "pk": 9, "fields": {"app_label": "rescuer", "model": "rescuer"}}, {"model": "sessions.session", "pk": "gltk62byce6huqhbjmsu6tq9biixb52b", "fields": {"session_data": ".eJxVjMsOwiAQRf-FtSFQCA-X7v0GMsMMUjWQlHZl_Hdt0oVu7znnvkSCba1pG7ykmcRZaHH63RDyg9sO6A7t1mXubV1mlLsiDzrktRM_L4f7d1Bh1G9tQgHOijMF1JHZIxTrCMmH6MtEzlprfEBUHCedgzMaY4BCTBQpKvH-ABf7OQ8:1q7I3m:tW8WF9frufnlI2QkpbNTUedtF8MAVCtyBd5yBhrHXCw", "expire_date": "2023-06-22T16:00:26.340Z"}}, {"model": "fbf.fallenbird", "pk": "202c30db-ee42-4922-8524-5d335e813b19", "fields": {"bird": "2650f644-b558-4cad-be0a-c7c25b3b97ed", "date_found": "2023-06-08T15:47:28Z", "place": "Käthe Kollwitz Strae 16", "created": "2023-06-08T15:47:40.184Z", "updated": "2023-06-08T15:47:40.184Z", "rescuer": "cbcd37de-c931-42e2-8fc8-0cd4a7e917f9", "user": 1}}, {"model": "fbf.fallenbird", "pk": "d4355c8c-4683-4b01-bc50-0e5045d12a9d", "fields": {"bird": "3b67f940-44f7-439d-9521-87790a860b62", "date_found": "2023-06-08T15:45:52Z", "place": "Arvid-Harnack-Straße 22", "created": "2023-06-08T15:46:49.292Z", "updated": "2023-06-08T15:46:49.292Z", "rescuer": "cbcd37de-c931-42e2-8fc8-0cd4a7e917f9", "user": 1}}, {"model": "fbf.bird", "pk": "2650f644-b558-4cad-be0a-c7c25b3b97ed", "fields": {"name": "Kohlmeise"}}, {"model": "fbf.bird", "pk": "3b67f940-44f7-439d-9521-87790a860b62", "fields": {"name": "Amsel"}}, {"model": "rescuer.rescuer", "pk": "afff90af-890d-4130-ada6-4ad5c65ed51b", "fields": {"gender": "Frau", "first_name": "Liz", "last_name": "Taylor", "street": "Friedenstraße", "street_number": "23", "city": "Jena", "zip_code": "07743", "state": "Deutschland", "date_of_birth": "2021-07-21", "email": "liz@email.de", "user": 1}}, {"model": "rescuer.rescuer", "pk": "cbcd37de-c931-42e2-8fc8-0cd4a7e917f9", "fields": {"gender": "Herr", "first_name": "Jim", "last_name": "Henson", "street": "Thomas-Mann-Straße", "street_number": "42", "city": "Jena", "zip_code": "07743", "state": "Deutschland", "date_of_birth": "2023-06-08", "email": "jim@email.de", "user": 1}}] \ No newline at end of file diff --git a/rescuer/__init__.py b/rescuer/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/rescuer/admin.py b/rescuer/admin.py new file mode 100644 index 0000000..3b13da0 --- /dev/null +++ b/rescuer/admin.py @@ -0,0 +1,17 @@ +from django.contrib import admin + +from django.contrib import admin +from .models import Rescuer + + +@admin.register(Rescuer) +class CustomerAdmin(admin.ModelAdmin): + list_display = [ + "last_name", + "first_name", + "street", + "street_number", + "city", + "state", + "user", + ] diff --git a/rescuer/apps.py b/rescuer/apps.py new file mode 100644 index 0000000..4944355 --- /dev/null +++ b/rescuer/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class RescuerConfig(AppConfig): + default_auto_field = "django.db.models.BigAutoField" + name = "rescuer" diff --git a/rescuer/migrations/0001_initial.py b/rescuer/migrations/0001_initial.py new file mode 100644 index 0000000..69ee7ab --- /dev/null +++ b/rescuer/migrations/0001_initial.py @@ -0,0 +1,64 @@ +# Generated by Django 4.2.2 on 2023-06-08 15:45 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion +import uuid + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name="Rescuer", + fields=[ + ( + "id", + models.UUIDField( + default=uuid.uuid4, + editable=False, + primary_key=True, + serialize=False, + ), + ), + ( + "gender", + models.CharField( + choices=[ + ("Frau", "Frau"), + ("Herr", "Herr"), + ("Divers", "Divers"), + ], + max_length=10, + ), + ), + ("first_name", models.CharField(max_length=200)), + ("last_name", models.CharField(max_length=200)), + ("street", models.CharField(max_length=200)), + ("street_number", models.CharField(max_length=20)), + ("city", models.CharField(max_length=200)), + ("zip_code", models.CharField(max_length=200)), + ( + "state", + models.CharField( + choices=[("Deutschland", "Deutschland")], max_length=200 + ), + ), + ("date_of_birth", models.DateField()), + ("email", models.EmailField(max_length=200)), + ( + "user", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to=settings.AUTH_USER_MODEL, + ), + ), + ], + ), + ] diff --git a/rescuer/migrations/__init__.py b/rescuer/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/rescuer/models.py b/rescuer/models.py new file mode 100644 index 0000000..8bad4e8 --- /dev/null +++ b/rescuer/models.py @@ -0,0 +1,31 @@ +from django.db import models + +from datetime import date +from uuid import uuid4 + +from django.conf import settings +from django.db import models + +STATE_CHOICES = [ + ("Deutschland", "Deutschland"), +] + +GENDER_CHOICES = [("Frau", "Frau"), ("Herr", "Herr"), ("Divers", "Divers")] + + +class Rescuer(models.Model): + id = models.UUIDField(primary_key=True, default=uuid4, editable=False) + gender = models.CharField(max_length=10, choices=GENDER_CHOICES) + first_name = models.CharField(max_length=200) + last_name = models.CharField(max_length=200) + street = models.CharField(max_length=200) + street_number = models.CharField(max_length=20) + city = models.CharField(max_length=200) + zip_code = models.CharField(max_length=200) + state = models.CharField(max_length=200, choices=STATE_CHOICES) + date_of_birth = models.DateField() + email = models.EmailField(max_length=200) + user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) + + def __str__(self) -> str: + return self.first_name + " " + self.last_name diff --git a/rescuer/tests.py b/rescuer/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/rescuer/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/rescuer/views.py b/rescuer/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/rescuer/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here.