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

environments/review-docs-overh-0jidv5/deployments/9379
petitminion 2022-01-23 10:52:41 +00:00 zatwierdzone przez Georg Krause
rodzic b53ced6ac9
commit 252ebf8ce7
10 zmienionych plików z 18 dodań i 12 usunięć

Wyświetl plik

@ -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:

Wyświetl plik

@ -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

Wyświetl plik

@ -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)

Wyświetl plik

@ -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

Wyświetl plik

@ -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
)

Wyświetl plik

@ -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

Wyświetl plik

@ -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

Wyświetl plik

@ -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

Wyświetl plik

@ -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

Wyświetl plik

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