Hi

> Le 7 nov. 2015 à 22:00, lnzy3...@gmx.de a écrit :
> 
>  
> It runs into an error. To me it seems like I cannot combine two models. My 
> goal is to access all the tasks attached to that user, or to add a task to 
> the user accessing the API at the moment
> So it would be very helpful, when someone could explains me the two issues:
> 1) How can I access the User information in a model? 

Depending on what you want to achieve, you can:
- use authentication, set the UserTask model to Task and override the view’s 
get_queryset to filter against the authenticated user (explained in the 
documentation at 
http://www.django-rest-framework.org/api-guide/filtering/#filtering-against-the-current-user)
- set the UserTask model to Task and filter the task list against a user 
(http://www.django-rest-framework.org/api-guide/filtering/#filtering-against-query-parameters)

> 2) How can I add data and attach that to a model.

You code snippet is correct except for the model attached to the view.

Regards,
Xavier,
Linovia.

-- 
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/6C0670E8-4F53-4A40-9020-66D7B291F1B1%40linovia.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to