X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/4bacdff72c8044d25066ff95719543a763844e11..8f031335a8a0dabceec381b89eb0cbbcb2f4b637:/src/catalogue/api/views.py?ds=sidebyside diff --git a/src/catalogue/api/views.py b/src/catalogue/api/views.py index c69c246ad..0f95f0ace 100644 --- a/src/catalogue/api/views.py +++ b/src/catalogue/api/views.py @@ -341,7 +341,10 @@ class TagView(RetrieveAPIView): obj = self.get_object() for data_field, model_field in fields.items(): setattr(obj, model_field, data.get(data_field, getattr(obj, model_field))) - obj.save(update_fields=fields.values(), quick=True) + if obj.pk: + obj.save(update_fields=fields.values(), quick=True) + else: + obj.save() return Response({})