Funny that I should run into this post the same day that I'm trying to
work out how to do this.
I've got the same problem. From the shell:
>>> user = User.objects.get(id = 3)
>>> user.get_all_permissions()
Set(['ivms.can_play'])
>>> user.has_perm('ivms.can_play')
True
Fantastic. When I try and access it via my template it doesn't work.
e.g.
{% if perms.ivms.can_play %}
I have permissions
{% else %}
I don't have permissions
{% endif %}
Do I need to load any template tags to access this tag?
Note that I'm still using 0.95.
Thanks,
Ben
On Mar 13, 12:02 am, "masuran" <[EMAIL PROTECTED]> wrote:
> Hello everyone,
>
> I've created a custom permission on one of my models and I've given a
> user the custom permission.
>
> When I go into the shell (manage.py shell), I can confirm that the
> user has the custom permission. But when I use thepermsobject in one
> of my templates, it simple doesn't work.
>
> {% ifperms.custom_perm %}
> do something
> {% endif %}
>
> According to the documentation, thepermsobject is included in
> thetemplatelanguage. So I assume I don't have to create the object and
> pass it to mytemplate?
> I've even tried the fix posted herehttp://code.djangoproject.com/ticket/2418
> but to no avail. I still can't use thepermsobject in mytemplate.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---