Hi, I have a view for creating new objects which inherits from 
generics.CreateAPIView.

Inside I override perform_create() like so:

u1 = get_object_or_404 (Usr.objects, login = self.request.user)
serialize.save(usr = u1)

I'd like to add logic to check whether the object to be created is already 
in the database and if so, just return the existing object. How can I 
accomplish this? And one more thing - can I only return some of the fields, 
but not others?

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-rest-framework/6e914571-a960-4999-9233-6ad0d56feb05n%40googlegroups.com.

Reply via email to