django - How I can get User.username and Group.name -


i need username , name of group user. model use user(default) , group(default)

index.html:

{% dato in usuarios %}     {{dato.first_name|title}}     {% item in jefes %}         {{dato.groups}}     {% if dato.groups == item.id %} #i don't know if         {{item.name}}     {% endif %}     {% endfor %} {% endfor %} 

view:

def inicio(request):     usuarios = user.group.all()     grupos = group.objects.all()     ctx = {'usuarios':usuarios,'grupos':grupos}     return render_to_response('index.html', ctx, context_instance=requestcontext(request)) 

you not need groups queryset view.

{% dato in usuarios %}     {{dato.first_name|title}}     {% group in dato.groups.all %}         {{group.name}}     {% endfor %} {% endfor %} 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -