                  # Otherwise assume the kwargs uniquely identify the model
                  filtered_keywords = kwargs.copy()
                  if BaseRenderer._FORMAT_QUERY_PARAM in filtered_keywords:
                      del filtered_keywords[BaseRenderer._FORMAT_QUERY_PARAM]
                  instance = model.objects.get(**filtered_keywords)
          except model.DoesNotExist:
              raise ErrorResponse(status.HTTP_404_NOT_FOUND)
  
          return instance
  
 
</s> remove                 instance = model.objects.get(pk=args[-1], **kwargs)
 </s> add                 self.model_instance = model.objects.get(pk=args[-1], **kwargs) </s> remove         return instance
 </s> add         return self.model_instance </s> remove                 instance = model.objects.get(**kwargs)
 </s> add                 self.model_instance = model.objects.get(**kwargs) </s> remove                 setattr(instance, key, val)
 </s> add                 setattr(self.model_instance, key, val) </s> remove                 instance = model.objects.get(pk=args[-1], **kwargs)
 </s> add                 self.model_instance = model.objects.get(pk=args[-1], **kwargs)
                self.model_instance = model.objects.get(**filtered_keywords)
                  # Otherwise assume the kwargs uniquely identify the model
                  filtered_keywords = kwargs.copy()
                  if BaseRenderer._FORMAT_QUERY_PARAM in filtered_keywords:
                      del filtered_keywords[BaseRenderer._FORMAT_QUERY_PARAM]
                self.model_instance = model.objects.get(**filtered_keywords)
          except model.DoesNotExist:
              raise ErrorResponse(status.HTTP_404_NOT_FOUND)
  
          return instance
  
keep keep keep keep replace keep keep keep keep keep
 FIX: ModelViews can have Resources whose models have unique fields.

ReadModelMixin and UpdateModelMixin store model instance as a property. This allows ModelResource to bind the ModelForm using the model instance making the form validate the input data against the model instance and not a brand new instance. When the latter happened and the model used unique fields, the form validation failed whenever a PUT was maintaining the previuos value of the unique field. 
djangorestframework/mixins.py