I am trying to decipher how .update() is being used in this context. Here's the code:
user = User.objects.get(username=username) userializer = UserSerializer(user) other = Other.objects.get(other=userializer.data['user_id']) oserializer = OtherSerializer(other) userdata = userializer.data userdata.update({'target_id': oserializer['target'].value}) And here's the UserSerializer:
class UserSerializer(serializers.ModelSerializer): class Meta: model = User fields = ('user_id', 'username', 'sec_question_1', 'sec_answer_1', 'sec_question_2', 'sec_answer_2', 'sec_question_3', 'sec_answer_3', 'roles') As you can tell, target_id is not in the serializer.
So I am wondering how the original model row is being updated by this .update() method, and I'm wondering where the documentation for it is - is this the QuerySet .update()? Is it the serializer .update() (which doesn't appear to exist - is there a default?)
I'm trying to rewrite this to be more robust and I'm having a hard time understanding what is going on.