django rest-auth get user profile -


i´m little bit lost... i´m trying develop ionic app witch needs authenticated versus django web application.

i installed django-rest-framework , django-rest-auth. i´m able login, getin user token, how can retrieve more user data?

url(r'^rest-auth/', include('rest_auth.urls')), url(r'^rest-token-auth/$',obtain_auth_token), 

with django-rest-auth in host.com/rest-auth/user/ url have data:

http 200 ok content-type: application/json vary: accept allow: get, put, head, options, patch  {     "username": "ikerib",     "email": "ikerib@gmail.com",     "first_name": null,     "last_name": null } 

but need more! id, user_photo, city...

i tried configuring user serializer this:

from rest_framework import serializers gamer.models import gameruser  class gameuserserializer(serializers.modelserializer):     class meta:         model = gameruser         fields = ('id', 'fullname', 'get_photo', 'karma') 

and view:

@csrf_exempt def gameuser_detail(request, pk):     try:         gameuser = gameuser.objects.get(pk=pk)     except gameuser.doesnotexist:         return httpresponse(status=404)      if request.method == 'get':         serializer = gameuserserializer(gameuser)         return jsonresponse(serializer.data) 

but i´m unable user data because don´t know user id..

any or clue???

thanks in advance

you can add custom serializer app settings this:

rest_auth_serializers = {     'user_details_serializer': 'path.to.custom.gameuserserializer', } 

http://django-rest-auth.readthedocs.org/en/latest/configuration.html


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -