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
Post a Comment