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!