possible bug with POST relation

13 views
Skip to first unread message

Patrick Kranzlmueller

unread,
May 19, 2013, 4:42:02 AM5/19/13
to django-res...@googlegroups.com
I've restricted get_queryset with a view (ModelViewSet) for the currently logged–in user.
When viewing the list, everythings fine when I'm trying to access an object bound to another user (404 not found).

However, when doing a POST and trying to add a wrong relation it works ... 

{
    "title":"test title",
    "bank_account":"/api/at/2012/bankaccounts/16/",
}

bank_account with ID 16 is not available with the logged–in user, but I'm able to POST it without getting an error.

Is this a bug or do I need to validate the bank account? If so, how do I validate because the user is not available with the serializer?

thx,
patrick

Patrick Kranzlmueller

unread,
May 19, 2013, 7:11:44 AM5/19/13
to django-res...@googlegroups.com
answering my own questions here.

I'm able to validate the bank_account with checking self.context["request"].user ... however, I'm still not sure POSTing that ressource should be possible in the first place.

patrick
Reply all
Reply to author
Forward
0 new messages