>
> James,
>

My apologies. stock_id came in as a artefact of a bad copy/paste.
The only deviation from what you have said is that the api call comes with 
a address string and not a id. But your solution works perfectly well as 
well.
Here are the right ones:

serializer=UserPrefSerializer(data=request.data)

seriazer object will be populated with post request data.
address_obj=Address.objects.get(symbol=request.data['address'])
user_obj=User.objects.get(username=request.user)

serializer.validated_data['address_id']=address_obj.id
serializer.validated_data['user_id']=user_obj.id

Thanks again,
S

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6782c6e4-451e-4285-9c2b-c9e9abdd3090%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to