From 0ab1dbea7a8277a6a25e12fb6b85105a70794a40 Mon Sep 17 00:00:00 2001 From: Alex Law Date: Sat, 14 Oct 2023 22:37:23 -0700 Subject: [PATCH] Update sponsor partner to match latest ERD --- app/core/admin.py | 3 ++- app/core/api/serializers.py | 3 ++- ..._sponsorpartner_is_org_partner_and_more.py | 21 +++++++++++++++++++ app/core/migrations/max_migration.txt | 2 +- app/core/models.py | 3 ++- app/core/tests/test_api.py | 3 ++- 6 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 app/core/migrations/0020_rename_is_sponsor_sponsorpartner_is_org_partner_and_more.py diff --git a/app/core/admin.py b/app/core/admin.py index 1848cbf9..f828b545 100644 --- a/app/core/admin.py +++ b/app/core/admin.py @@ -144,7 +144,8 @@ class SponsorPartnerAdmin(admin.ModelAdmin): "partner_logo", "is_active", "url", - "is_sponsor", + "is_org_sponsor", + "is_org_partner", ) diff --git a/app/core/api/serializers.py b/app/core/api/serializers.py index a8545216..e0bcecfd 100644 --- a/app/core/api/serializers.py +++ b/app/core/api/serializers.py @@ -132,7 +132,8 @@ class Meta: "partner_logo", "is_active", "url", - "is_sponsor", + "is_org_sponsor", + "is_org_partner", ) read_only_fields = ( "uuid", diff --git a/app/core/migrations/0020_rename_is_sponsor_sponsorpartner_is_org_partner_and_more.py b/app/core/migrations/0020_rename_is_sponsor_sponsorpartner_is_org_partner_and_more.py new file mode 100644 index 00000000..fd9b25e6 --- /dev/null +++ b/app/core/migrations/0020_rename_is_sponsor_sponsorpartner_is_org_partner_and_more.py @@ -0,0 +1,21 @@ +# Generated by Django 4.0.10 on 2023-11-04 23:44 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [("core", "0019_stackelementtype")] + + operations = [ + migrations.RenameField( + model_name="sponsorpartner", + old_name="is_sponsor", + new_name="is_org_sponsor", + ), + migrations.AddField( + model_name="sponsorpartner", + name="is_org_partner", + field=models.BooleanField(null=True), + ), + ] diff --git a/app/core/migrations/max_migration.txt b/app/core/migrations/max_migration.txt index 8810f9cd..38228e22 100644 --- a/app/core/migrations/max_migration.txt +++ b/app/core/migrations/max_migration.txt @@ -1 +1 @@ -0019_stackelementtype +0020_rename_is_sponsor_sponsorpartner_is_org_partner_and_more diff --git a/app/core/models.py b/app/core/models.py index 708db933..13044875 100644 --- a/app/core/models.py +++ b/app/core/models.py @@ -179,7 +179,8 @@ class SponsorPartner(AbstractBaseModel): partner_logo = models.URLField(blank=True) is_active = models.BooleanField(null=True) url = models.URLField(blank=True) - is_sponsor = models.BooleanField(null=True) + is_org_sponsor = models.BooleanField(null=True) + is_org_partner = models.BooleanField(null=True) # PK of this model is the ForeignKey for project_partner_xref diff --git a/app/core/tests/test_api.py b/app/core/tests/test_api.py index 0e17bcb0..59b95ffb 100644 --- a/app/core/tests/test_api.py +++ b/app/core/tests/test_api.py @@ -178,7 +178,8 @@ def test_create_sponsor_partner(auth_client): "partner_logo": "http://www.logourl.com", "is_active": True, "url": "http://www.testurl.org", - "is_sponsor": True, + "is_org_sponsor": True, + "is_org_partner": True, } res = auth_client.post(SPONSOR_PARTNERS_URL, payload) assert res.status_code == status.HTTP_201_CREATED