              tmp.update({'pk': args[-1]})
          return Q(**tmp)
  
  
      def get_instance_data(self, model, content, *args, **kwargs):
  
          tmp = dict(kwargs)
  
          for field in model._meta.fields:
              if isinstance(field, ForeignKey) and tmp.has_key(field.name):
 
</s> remove             # While this code simply follows the previous behaviour, we feel this 
            # is somehow strange to use 'pk' with any other query parameters... isn't it?

 </s> add  </s> remove         
        # This methods simply mimics the previous behaviour of the framework, where
        # the following code was used few times in to retrive the instance:
        #
        # ------------------------------
        # if args:
        #     #If we have any none kwargs then assume the last represents the primrary key
        #     instance = model.objects.get(pk=args[-1], **kwargs)
        # else:
        #     # Otherwise assume the kwargs uniquely identify the model
        #     instance = model.objects.get(**kwargs)
        # -----------------------------
        # 
        # this block is now replaced with
        #
        # -------------
        # instance = model.objects.get(self.build_query(*args, **kwargs)
        # -------------
        #
        # which is more DRY + gives the simple possibility to provide 
        # *any* arguments in URL
        #
 </s> add         """ Returns django.db.models.Q object to be used for the objects retrival.

        Arguments:
        - args: unnamed URL arguments
        - kwargs: named URL arguments

        If a URL passes any arguments to the view being the QueryMixin subclass
        build_query manages the arguments and provides the Q object that will be
        used for the objects retrival with filter/get queryset methods.

        Technically, either args nor kwargs have to be provided, however the default
        behaviour is to map all kwargs as the query constructors so that if this 
        method is not overriden only kwargs keys being model fields are valid. 

        If args are provided, the last one (args[-1) is understood as instance pk. This
        should be removed in the future, though.

        """ </s> remove             # args + kwartgs were not provided...
            # self.model_instance = model(**self.CONTENT)
            # self.model_instance.save()

 </s> add  </s> remove         if args:
            all_kw_args.update({'pk': args[-1]})

 </s> add 
    def get_instance_data(self, model, content, **kwargs):
        """ Returns the dict with the data for model instance creation/update query.

        Arguments:
        - model: model class (django.db.models.Model subclass) to work with
        - content: a dictionary with instance data
        - kwargs: a dict of URL provided keyword arguments

        The create/update queries are created basicly with the contet provided
        with POST/PUT HTML methods and kwargs passed in the URL. This methods simply merges
        the URL data and the content preaparing the ready-to-use data dictionary.
        
        """
              tmp.update({'pk': args[-1]})
          return Q(**tmp)
  
  
    def get_instance_data(self, model, content, **kwargs):
        """ Returns the dict with the data for model instance creation/update query.

        Arguments:
        - model: model class (django.db.models.Model subclass) to work with
        - content: a dictionary with instance data
        - kwargs: a dict of URL provided keyword arguments

        The create/update queries are created basicly with the contet provided
        with POST/PUT HTML methods and kwargs passed in the URL. This methods simply merges
        the URL data and the content preaparing the ready-to-use data dictionary.
        
        """
  
          tmp = dict(kwargs)
  
          for field in model._meta.fields:
              if isinstance(field, ForeignKey) and tmp.has_key(field.name):
keep keep keep keep replace keep keep keep keep keep
 QueryMixin class updates (comments + docs and the definition of get_instance_data method) 
djangorestframework/mixins.py