Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use type[Model] instead of ModelBase #4050

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading