From a2cb4cbdc87d2fba339aa17149055ca73665dcd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciar=C3=A1n=20Ainsworth?= Date: Tue, 19 Jul 2022 15:32:09 +0200 Subject: [PATCH] Make content_category non-nullable --- api/config/settings/local.py | 1 - .../0056_alter_artist_content_category.py | 18 ++++++++++++++++++ api/funkwhale_api/music/models.py | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 api/funkwhale_api/music/migrations/0056_alter_artist_content_category.py diff --git a/api/config/settings/local.py b/api/config/settings/local.py index 668434542..37eac1903 100644 --- a/api/config/settings/local.py +++ b/api/config/settings/local.py @@ -132,7 +132,6 @@ SPECTACULAR_SETTINGS = { "OAUTH2_AUTHORIZATION_URL": "/authorize", "OAUTH2_TOKEN_URL": "/api/v1/oauth/token/", "PREPROCESSING_HOOKS": ["config.schema.custom_preprocessing_hook"], - 'ENUM_ADD_EXPLICIT_BLANK_NULL_CHOICE': False, "ENUM_NAME_OVERRIDES": { "FederationChoiceEnum": "funkwhale_api.federation.models.TYPE_CHOICES", "ReportTypeEnum": "funkwhale_api.moderation.models.REPORT_TYPES", diff --git a/api/funkwhale_api/music/migrations/0056_alter_artist_content_category.py b/api/funkwhale_api/music/migrations/0056_alter_artist_content_category.py new file mode 100644 index 000000000..5b80f1f71 --- /dev/null +++ b/api/funkwhale_api/music/migrations/0056_alter_artist_content_category.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.14 on 2022-07-19 13:28 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('music', '0055_auto_20220627_1915'), + ] + + operations = [ + migrations.AlterField( + model_name='artist', + name='content_category', + field=models.CharField(choices=[('music', 'music'), ('podcast', 'podcast'), ('other', 'other')], db_index=True, default='music', max_length=30), + ), + ] diff --git a/api/funkwhale_api/music/models.py b/api/funkwhale_api/music/models.py index de2dda0a8..9829a989b 100644 --- a/api/funkwhale_api/music/models.py +++ b/api/funkwhale_api/music/models.py @@ -251,7 +251,7 @@ class Artist(APIModelMixin): db_index=True, default="music", choices=ARTIST_CONTENT_CATEGORY_CHOICES, - null=True, + null=False, ) modification_date = models.DateTimeField(default=timezone.now, db_index=True) api = musicbrainz.api.artists