MCPcopy Index your code
hub / github.com/encode/django-rest-framework / update

Method update

rest_framework/mixins.py:63–75  ·  view source on GitHub ↗
(self, request, *args, **kwargs)

Source from the content-addressed store, hash-verified

61 Update a model instance.
62 """
63 def update(self, request, *args, **kwargs):
64 partial = kwargs.pop('partial', False)
65 instance = self.get_object()
66 serializer = self.get_serializer(instance, data=request.data, partial=partial)
67 serializer.is_valid(raise_exception=True)
68 self.perform_update(serializer)
69
70 if getattr(instance, '_prefetched_objects_cache', None):
71 # If 'prefetch_related' has been applied to a queryset, we need to
72 # forcibly invalidate the prefetch cache on the instance.
73 instance._prefetched_objects_cache = {}
74
75 return Response(serializer.data)
76
77 def perform_update(self, serializer):
78 serializer.save()

Callers 15

partial_updateMethod · 0.95
getMethod · 0.45
requestMethod · 0.45
__init__Method · 0.45
putMethod · 0.45
putMethod · 0.45
putMethod · 0.45
render_fieldMethod · 0.45
_load_data_and_filesMethod · 0.45
_get_dynamic_routeMethod · 0.45
get_urlsMethod · 0.45
__or__Method · 0.45

Calls 5

perform_updateMethod · 0.95
ResponseClass · 0.90
get_objectMethod · 0.45
get_serializerMethod · 0.45
is_validMethod · 0.45

Tested by 2

getMethod · 0.36
requestMethod · 0.36