From dd58b7b35cbad4e3e71c37b54d26f5d44d3363b2 Mon Sep 17 00:00:00 2001 From: Parfait Detchenou Date: Thu, 19 Dec 2024 16:08:00 +0100 Subject: [PATCH] drop type hints to support python 3.6+ --- django_restql/mixins.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/django_restql/mixins.py b/django_restql/mixins.py index c3ec5fc..ec11172 100644 --- a/django_restql/mixins.py +++ b/django_restql/mixins.py @@ -633,21 +633,19 @@ def create_many_to_one_related(self, instance, data): field_pks.update({field: pks}) return field_pks - def create_many_to_one_generic_related( - self, instance: Model, data: dict[str, dict] - ): + def create_many_to_one_generic_related(self, instance, data): field_pks = {} nested_fields = self.restql_writable_nested_fields content_type = ContentType.objects.get_for_model(instance) for field, values in data.items(): - relation: GenericRelation = getattr(self.Meta.model, field).field + relation = getattr(self.Meta.model, field).field nested_field_serializer = nested_fields[field].child serializer_class = nested_field_serializer.serializer_class kwargs = nested_field_serializer.validation_kwargs - model: type[Model] = nested_field_serializer.Meta.model + model = nested_field_serializer.Meta.model for operation in values: if operation == ADD: @@ -879,7 +877,7 @@ def bulk_update_many_to_many_related(self, field, nested_obj, data): obj = serializer.save() def bulk_update_many_to_one_related( - self, field, instance, data, update_foreign_key: bool = True + self, field, instance, data, update_foreign_key=True ): # {pk: {sub_field: values}}