Skip to content

Commit

Permalink
Remove unnecessary Python version compatibility bits
Browse files Browse the repository at this point in the history
  • Loading branch information
akx committed Dec 20, 2023
1 parent bd18ac5 commit bfb6b3d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 13 deletions.
9 changes: 0 additions & 9 deletions polymorphic/compat.py

This file was deleted.

4 changes: 1 addition & 3 deletions polymorphic/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
from django.db.models.fields.related import ForwardManyToOneDescriptor, ReverseOneToOneDescriptor
from django.db.utils import DEFAULT_DB_ALIAS

from polymorphic.compat import with_metaclass

from .base import PolymorphicModelBase
from .managers import PolymorphicManager
from .query_translate import translate_polymorphic_Q_object
Expand All @@ -24,7 +22,7 @@ class PolymorphicTypeInvalid(RuntimeError):
pass


class PolymorphicModel(with_metaclass(PolymorphicModelBase, models.Model)):
class PolymorphicModel(models.Model, metaclass=PolymorphicModelBase):
"""
Abstract base class that provides polymorphic behaviour
for any model directly or indirectly derived from it.
Expand Down
2 changes: 1 addition & 1 deletion polymorphic/query_translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def translate_polymorphic_filter_definitions_in_kwargs(
Returns: a list of non-keyword-arguments (Q objects) to be added to the filter() query.
"""
additional_args = []
for field_path, val in kwargs.copy().items(): # Python 3 needs copy
for field_path, val in kwargs.copy().items(): # `copy` so we're not mutating the dict
new_expr = _translate_polymorphic_filter_definition(
queryset_model, field_path, val, using=using
)
Expand Down

0 comments on commit bfb6b3d

Please sign in to comment.