Skip to content

Commit

Permalink
drop type hints to support python 3.6+
Browse files Browse the repository at this point in the history
  • Loading branch information
exkson committed Dec 19, 2024
1 parent 3ab60d0 commit dd58b7b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions django_restql/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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}}

Expand Down

0 comments on commit dd58b7b

Please sign in to comment.