Browse Source

Remove usage of deprecated Model and Serializer fields (#1663)

merge-requests/1483/head
petitminion 4 months ago
committed by Georg Krause
parent
commit
252ebf8ce7
  1. 3
      api/config/settings/common.py
  2. 2
      api/funkwhale_api/audio/models.py
  3. 6
      api/funkwhale_api/common/models.py
  4. 6
      api/funkwhale_api/federation/models.py
  5. 4
      api/funkwhale_api/federation/serializers.py
  6. 2
      api/funkwhale_api/moderation/models.py
  7. 2
      api/funkwhale_api/music/models.py
  8. 2
      api/funkwhale_api/radios/models.py
  9. 2
      api/funkwhale_api/users/models.py
  10. 1
      changes/changelog.d/1663-bugfix

3
api/config/settings/common.py

@ -381,6 +381,9 @@ MIGRATION_MODULES = {
"sites": "funkwhale_api.contrib.sites.migrations",
}
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
# see https://docs.djangoproject.com/en/4.0/releases/3.2/
# GENERAL CONFIGURATION
# ------------------------------------------------------------------------------
# Local time zone for this installation. Choices can be found here:

2
api/funkwhale_api/audio/models.py

@ -2,7 +2,7 @@ import uuid
from django.contrib.contenttypes.fields import GenericRelation
from django.contrib.postgres.fields import JSONField
from django.db.models import JSONField
from django.core.serializers.json import DjangoJSONEncoder
from django.db import models
from django.urls import reverse

6
api/funkwhale_api/common/models.py

@ -2,7 +2,7 @@ import uuid
import magic
import mimetypes
from django.contrib.postgres.fields import JSONField
from django.db.models import JSONField
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.conf import settings
@ -116,10 +116,10 @@ class Mutation(models.Model):
type = models.CharField(max_length=100, db_index=True)
# None = no choice, True = approved, False = refused
is_approved = models.NullBooleanField(default=None)
is_approved = models.BooleanField(default=None, null=True)
# None = not applied, True = applied, False = failed
is_applied = models.NullBooleanField(default=None)
is_applied = models.BooleanField(default=None, null=True)
creation_date = models.DateTimeField(default=timezone.now, db_index=True)
applied_date = models.DateTimeField(null=True, blank=True, db_index=True)
summary = models.TextField(max_length=2000, null=True, blank=True)

6
api/funkwhale_api/federation/models.py

@ -3,7 +3,7 @@ import urllib.parse
import uuid
from django.conf import settings
from django.contrib.postgres.fields import JSONField
from django.db.models import JSONField
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ObjectDoesNotExist
@ -198,7 +198,7 @@ class Actor(models.Model):
private_key = models.TextField(max_length=5000, null=True, blank=True)
creation_date = models.DateTimeField(default=timezone.now)
last_fetch_date = models.DateTimeField(default=timezone.now)
manually_approves_followers = models.NullBooleanField(default=None)
manually_approves_followers = models.BooleanField(default=None, null=True)
followers = models.ManyToManyField(
to="self",
symmetrical=False,
@ -488,7 +488,7 @@ class AbstractFollow(models.Model):
uuid = models.UUIDField(default=uuid.uuid4, unique=True)
creation_date = models.DateTimeField(default=timezone.now)
modification_date = models.DateTimeField(auto_now=True)
approved = models.NullBooleanField(default=None)
approved = models.BooleanField(default=None, null=True)
class Meta:
abstract = True

4
api/funkwhale_api/federation/serializers.py

@ -237,7 +237,9 @@ class ActorSerializer(jsonld.JsonLdSerializer):
choices=[getattr(contexts.AS, c[0]) for c in models.TYPE_CHOICES]
)
preferredUsername = serializers.CharField()
manuallyApprovesFollowers = serializers.NullBooleanField(required=False)
manuallyApprovesFollowers = serializers.BooleanField(
required=False, allow_null=True
)
name = serializers.CharField(
required=False, max_length=200, allow_blank=True, allow_null=True
)

2
api/funkwhale_api/moderation/models.py

@ -3,7 +3,7 @@ import uuid
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
from django.contrib.contenttypes.models import ContentType
from django.contrib.postgres.fields import JSONField
from django.db.models import JSONField
from django.db import models
from django.db.models.signals import pre_save
from django.dispatch import receiver

2
api/funkwhale_api/music/models.py

@ -12,7 +12,7 @@ import arrow
import pydub
from django.conf import settings
from django.contrib.contenttypes.fields import GenericRelation
from django.contrib.postgres.fields import JSONField
from django.db.models import JSONField
from django.contrib.postgres.search import SearchVectorField
from django.contrib.postgres.indexes import GinIndex
from django.core.exceptions import ObjectDoesNotExist

2
api/funkwhale_api/radios/models.py

@ -1,6 +1,6 @@
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.contrib.postgres.fields import JSONField
from django.db.models import JSONField
from django.core.serializers.json import DjangoJSONEncoder
from django.db import models
from django.utils import timezone

2
api/funkwhale_api/users/models.py

@ -9,7 +9,7 @@ import uuid
from django.conf import settings
from django.contrib.auth.models import AbstractUser, UserManager as BaseUserManager
from django.contrib.postgres.fields import JSONField
from django.db.models import JSONField
from django.db import models, transaction
from django.dispatch import receiver
from django.urls import reverse

1
changes/changelog.d/1663-bugfix

@ -0,0 +1 @@
Remove usage of deprecated Model and Serializer fields (#1663)
Loading…
Cancel
Save