Skip to content
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
8 changes: 4 additions & 4 deletions contentcuration/contentcuration/viewsets/base.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -464,7 +464,7 @@ def values_from_key(cls, key):
# to create key, value pairs for a dict
# Order in the key matters, and must match the "update_lookup_field"
# property of the serializer.
return [(attr, value) for attr, value in zip(id_attr, key)]
return list(zip(id_attr, key))
return []

@classmethod
Expand All@@ -484,7 +484,7 @@ def filter_queryset_from_keys(cls, queryset, keys):
# improvements welcome!
query = Q()
for key in keys:
query |= Q(**{attr: value for attr, value in zip(id_attr, key)})
query |= Q(**dict(zip(id_attr, key)))
return queryset.filter(query)
return queryset.none()

Expand DownExpand Up@@ -603,7 +603,7 @@ def retrieve(self, request, *args, **kwargs):
class CreateModelMixin(object):
def _map_create_change(self, change):
return dict(
[(k, v) for k, v in change["obj"].items()]
list(change["obj"].items())
+ self.values_from_key(change["key"])
)

Expand DownExpand Up@@ -678,7 +678,7 @@ def delete_from_changes(self, changes):
class UpdateModelMixin(object):
def _map_update_change(self, change):
return dict(
[(k, v) for k, v in change["mods"].items()]
list(change["mods"].items())
+ self.values_from_key(change["key"])
)

Expand Down
2 changes: 1 addition & 1 deletion contentcuration/contentcuration/viewsets/common.py
Original file line numberDiff line numberDiff line change
Expand Up@@ -196,7 +196,7 @@ def to_internal_value(self, data):
if self.child_relation.pk_field is not None:
pks = [self.child_relation.pk_field.to_internal_value(d) for d in data]
else:
pks = [d for d in data]
pks = list(data)
valid_pks = (
self.child_relation.get_queryset()
.filter(pk__in=pks)
Expand Down