Pregunta

Django Nonrel Groups Issue

Django Nonrel branch version 1.4 of Django is being used. Groups from: https://github.com/django-nonrel/django-permission-backend-nonrel

The admin section works fine. I am able to create groups, assign them to users.

Now adding them to the template throws an error.

{% for group in user.groups.all %}
    {{group.name}}

    {% endfor %}

The error I am getting is:

This query is not supported by the database.
¿Fue útil?

Solución

I believe user.groups is a List of keys to groups. I don't think that djangotoolbox or djangoappengine currently will generate a query for a list of keys. You can try updating djangotoolbox to handle this case, or more easily, you can issue a query outside the template for Group.objects.filter(id__in=user.groups), and then pass that into the template.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top