Compare commits
No commits in common. "e9246cc47f00717bb58cef74970761ae0045a965" and "643c45882fe39d3bf96cbb67d5484395132ad510" have entirely different histories.
e9246cc47f
...
643c45882f
|
|
@ -20,7 +20,6 @@ from drf_yasg.utils import swagger_auto_schema
|
||||||
import json
|
import json
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
from django.db.utils import NotSupportedError
|
|
||||||
|
|
||||||
class CustomGenericViewSet(MyLoggingMixin, GenericViewSet):
|
class CustomGenericViewSet(MyLoggingMixin, GenericViewSet):
|
||||||
"""
|
"""
|
||||||
|
|
@ -110,11 +109,9 @@ class CustomGenericViewSet(MyLoggingMixin, GenericViewSet):
|
||||||
filter_kwargs = {self.lookup_field: self.kwargs[lookup_url_kwarg]}
|
filter_kwargs = {self.lookup_field: self.kwargs[lookup_url_kwarg]}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
obj = queryset.get(**filter_kwargs)
|
obj = queryset.select_for_update().get(**filter_kwargs)
|
||||||
l_obj = queryset.model.objects.select_for_update().get(pk=obj.pk)
|
|
||||||
self.check_object_permissions(self.request, obj)
|
self.check_object_permissions(self.request, obj)
|
||||||
return l_obj
|
return obj
|
||||||
|
|
||||||
except ObjectDoesNotExist:
|
except ObjectDoesNotExist:
|
||||||
raise Http404
|
raise Http404
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue