From bb55490a914b7bd5981331e52af23adee9a4a349 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Wed, 2 Nov 2022 23:52:28 +0100 Subject: [PATCH] Move parties to separate app --- .idea/charasheet.iml | 1 + src/character/admin.py | 6 -- src/character/migrations/0036_delete_party.py | 19 +++++ src/character/migrations/max_migration.txt | 2 +- src/character/models/__init__.py | 2 - src/charasheet/settings.py | 1 + src/charasheet/urls.py | 1 + src/common/templates/common/navbar.html | 11 ++- src/party/__init__.py | 0 src/party/admin.py | 9 +++ src/party/apps.py | 6 ++ src/party/forms.py | 9 +++ src/party/migrations/0001_initial.py | 74 +++++++++++++++++++ src/party/migrations/__init__.py | 0 src/party/migrations/max_migration.txt | 1 + .../models/party.py => party/models.py} | 17 ++++- src/party/templates/party/parties_list.html | 27 +++++++ src/party/templates/party/party_create.html | 14 ++++ .../templates/party/snippets/party_card.html | 12 +++ src/party/tests/__init__.py | 0 src/party/tests/test_models.py | 30 ++++++++ src/party/urls.py | 9 +++ src/party/views.py | 30 ++++++++ 23 files changed, 268 insertions(+), 13 deletions(-) create mode 100644 src/character/migrations/0036_delete_party.py create mode 100644 src/party/__init__.py create mode 100644 src/party/admin.py create mode 100644 src/party/apps.py create mode 100644 src/party/forms.py create mode 100644 src/party/migrations/0001_initial.py create mode 100644 src/party/migrations/__init__.py create mode 100644 src/party/migrations/max_migration.txt rename src/{character/models/party.py => party/models.py} (57%) create mode 100644 src/party/templates/party/parties_list.html create mode 100644 src/party/templates/party/party_create.html create mode 100644 src/party/templates/party/snippets/party_card.html create mode 100644 src/party/tests/__init__.py create mode 100644 src/party/tests/test_models.py create mode 100644 src/party/urls.py create mode 100644 src/party/views.py diff --git a/.idea/charasheet.iml b/.idea/charasheet.iml index 391aeba..b15df4a 100644 --- a/.idea/charasheet.iml +++ b/.idea/charasheet.iml @@ -29,6 +29,7 @@ diff --git a/src/character/admin.py b/src/character/admin.py index 9d0888e..fd451f5 100644 --- a/src/character/admin.py +++ b/src/character/admin.py @@ -210,9 +210,3 @@ class WeaponAdmin(admin.ModelAdmin): class HarmfulStateAdmin(admin.ModelAdmin): list_display = ["name", "description"] search_fields = ["name"] - - -@admin.register(models.Party) -class PartyAdmin(admin.ModelAdmin): - list_display = ["name", "game_master"] - search_fields = ["name"] diff --git a/src/character/migrations/0036_delete_party.py b/src/character/migrations/0036_delete_party.py new file mode 100644 index 0000000..984b110 --- /dev/null +++ b/src/character/migrations/0036_delete_party.py @@ -0,0 +1,19 @@ +# Generated by Django 4.1.2 on 2022-11-02 22:28 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ( + "character", + "0035_alter_capability_options_alter_harmfulstate_options_and_more", + ), + ] + + operations = [ + migrations.DeleteModel( + name="Party", + ), + ] diff --git a/src/character/migrations/max_migration.txt b/src/character/migrations/max_migration.txt index f9e6e2f..208836e 100644 --- a/src/character/migrations/max_migration.txt +++ b/src/character/migrations/max_migration.txt @@ -1 +1 @@ -0035_alter_capability_options_alter_harmfulstate_options_and_more +0036_delete_party diff --git a/src/character/models/__init__.py b/src/character/models/__init__.py index db3967e..c945787 100644 --- a/src/character/models/__init__.py +++ b/src/character/models/__init__.py @@ -1,7 +1,6 @@ from .capabilities import Capability, Path, RacialCapability from .character import Character, HarmfulState, Profile, Race from .equipment import Weapon -from .party import Party __all__ = [ "Capability", @@ -12,5 +11,4 @@ __all__ = [ "Profile", "Race", "Weapon", - "Party", ] diff --git a/src/charasheet/settings.py b/src/charasheet/settings.py index 3490f5a..e2a67c7 100644 --- a/src/charasheet/settings.py +++ b/src/charasheet/settings.py @@ -75,6 +75,7 @@ CUSTOM_APPS = [ "whitenoise.runserver_nostatic", # should be first "common", "character", + "party", ] INSTALLED_APPS = CUSTOM_APPS + DJANGO_APPS + EXTERNAL_APPS diff --git a/src/charasheet/urls.py b/src/charasheet/urls.py index 5c5f2a1..101fa47 100644 --- a/src/charasheet/urls.py +++ b/src/charasheet/urls.py @@ -48,6 +48,7 @@ urlpatterns = [ path("admin/", admin.site.urls), path("", hello_world, name="hello_world"), path("character/", include("character.urls", namespace="character")), + path("party/", include("party.urls", namespace="party")), ] urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/src/common/templates/common/navbar.html b/src/common/templates/common/navbar.html index 48b33e7..0142e7f 100644 --- a/src/common/templates/common/navbar.html +++ b/src/common/templates/common/navbar.html @@ -7,16 +7,21 @@