Lines Matching refs:instance
53 instance = cls.from_uri_args(request, **kwargs)
57 instance.read_query_parameters(request.GET)
58 return instance.handle_request()
108 """Construct an instance from URI args.
323 def __init__(self, request, instance):
326 self.instance = instance
331 def from_optional_instance(cls, request, instance):
332 if instance is None:
334 return cls(request, instance)
338 self.instance.delete()
353 method also marks the instance as prepared, so it's safe to call this
354 multiple times with the same instance(s) without wasting work.
358 cls._do_prepare_for_full_representation([entry.instance
412 def _entry_from_instance(self, instance):
413 return self.entry_class(self._request, instance)
417 entries = [self._entry_from_instance(instance)
418 for instance in entry_instances]
499 instance = self.entry_class.create_instance(input_dict, self)
500 entry = self._entry_from_instance(instance)
555 def _get_related_manager(cls, instance):
556 """Get the related objects manager for the given instance.
558 The instance must be one of the related classes. This method will
559 return the related manager from that instance to instances of the other
562 this_model = type(instance)
565 if isinstance(instance, models[0]):
580 return getattr(instance, manager_name)
586 related_manager = self._get_related_manager(entry.instance)
587 related_manager.remove(other_entry.instance)
596 related_manager = cls._get_related_manager(entry.instance)
597 related_manager.add(other_entry.instance)
598 return other_entry.instance
627 The entry must be an instance of one of the related entry classes. This
642 entry.instance)
669 pk=other_fixed_entry.instance.id)
672 def _entry_from_instance(self, instance):
673 unfixed_entry = self.unfixed_class(self._request, instance)