Skip to content

Commit

Permalink
Merge pull request #4050 from open-formulieren/remove-modelbase
Browse files Browse the repository at this point in the history
Use `type[Model]` instead of `ModelBase`
  • Loading branch information
sergei-maertens authored Mar 22, 2024
2 parents 7983404 + 9b3ffe2 commit bd711ab
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/openforms/translations/api/serializers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import cast

from django.conf import settings
from django.db.models.base import ModelBase
from django.utils.translation import gettext_lazy as _

from modeltranslation.manager import get_translatable_fields_for_model
Expand Down Expand Up @@ -93,7 +92,7 @@ def _get_field(self, language_code: str):

parent = cast(serializers.ModelSerializer, parent)
base = type(parent)
model: ModelBase = parent.Meta.model
model = parent.Meta.model
# get the translatable models fields, with deterministic ordering
_translatable_fields = get_translatable_fields_for_model(model) or []
translatable_fields = [
Expand Down
4 changes: 2 additions & 2 deletions src/openforms/utils/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
import logging

from django.db import models, transaction
from django.db.models.base import ModelBase
from django.db.models import Model
from django.db.models.fields.files import FieldFile

logger = logging.getLogger(__name__)


def get_file_field_names(model: ModelBase) -> list[str]:
def get_file_field_names(model: type[Model]) -> list[str]:
"""
Collect names of :class:`django.db.models.FileField` (& subclass) model fields.
"""
Expand Down

0 comments on commit bd711ab

Please sign in to comment.