Re: {{ perms }} seems to be empty

2007-07-03 Thread rskm1
Jeremy Dunck wrote: > On 5/23/07, Michael Lake <[EMAIL PROTECTED]> wrote: > ... > > return render_to_response('lab/user.html', data) > > Yeah, that's your problem right there. > : > ... I imagine this bites a lot of people on the ass. :( Add me to the list of ass-bitten and extremely frust

Re: {{ perms }} seems to be empty

2007-07-03 Thread rskm1
rskm1 wrote: > Any chance of getting the _DOCS_ updated? > > For example, it would be nice if the first place {{perms.foo}} was > mentioned would at least hint that it wouldn't work in conjunction > with the render_to_response() shortcut, or perhaps it could introduce > the RequestContext class (

Re: {{ perms }} seems to be empty

2007-05-24 Thread Jeremy Dunck
On 5/23/07, Michael Lake <[EMAIL PROTECTED]> wrote: ... > Oh I'll probably just be doing stuff like: > > {% if perms.lab.add_experiment %} > < a href="something">Click to add experiment. ... This should work. > Also I should ask: > return render_to_response('lab/user.html', data)

RE: {{ perms }} seems to be empty

2007-05-24 Thread Chris Brand
> I guess you're looking for any permissions that are for the 'lab' app? > > Consider moving this into the view or writing a template tag-- There's > not an easy way to do str.startswith in a template, which is what > you'd need here. I thought you could do {% if perms.lab %} for "any permission

Re: {{ perms }} seems to be empty

2007-05-23 Thread Michael Lake
Jeremy Dunck wrote: > On 5/23/07, Michael Lake <[EMAIL PROTECTED]> wrote: >>I notice it's a Set object comprising a single list. So I thought I could do >>this: >> >>{% for item in perms.lab %} >>{{ item }} >>{% endfor %} > > > Yeah, you can't do attribute access like that for a set. I

Re: {{ perms }} seems to be empty

2007-05-23 Thread Jeremy Dunck
On 5/23/07, Michael Lake <[EMAIL PROTECTED]> wrote: ... > I notice it's a Set object comprising a single list. So I thought I could do > this: > > {% for item in perms.lab %} > {{ item }} > {% endfor %} Yeah, you can't do attribute access like that for a set. It's not the same as a dict

Re: {{ perms }} seems to be empty

2007-05-23 Thread Michael Lake
Jeremy Dunck wrote: > Should be: > > from django.template import RequestContext > ctx = RequestContext(request, data) > return render_to_response('lab/user.html', context_instance=ctx) Ah ha :-) Now it works and I get... perms={% if perms.lab %} yes perms {{ perms.lab }} {% else %}

Re: {{ perms }} seems to be empty

2007-05-23 Thread Jeremy Dunck
Arg! This: > from django.template import RequestContext > ctx = RequestContext(request) > return render_to_response('lab/user.html', context_instance=ctx) Should be: from django.template import RequestContext ctx = RequestContext(request, data) return render_to_response('lab/user.html', contex

Re: {{ perms }} seems to be empty

2007-05-23 Thread Jeremy Dunck
On 5/23/07, Michael Lake <[EMAIL PROTECTED]> wrote: ... > return render_to_response('lab/user.html', data) Yeah, that's your problem right there. You want this: from django.template import RequestContext ctx = RequestContext(request) return render_to_response('lab/user.html', context_insta

Re: {{ perms }} seems to be empty

2007-05-23 Thread Michael Lake
Hi all Martin Hsu suggested to make sure that this is included so I now have this in settings.py TEMPLATE_CONTEXT_PROCESSORS= ("django.core.context_processors.auth", "django.core.context_processors.debug", "django.core.context_processors.i18n") Still {{ perms }} is empty or at least not displa

Re: {{ perms }} seems to be empty

2007-05-23 Thread Jeremy Dunck
On 5/23/07, Aidas Bendoraitis <[EMAIL PROTECTED]> wrote: > > Is "django.core.context_processors.auth" set in your > TEMPLATE_CONTEXT_PROCESSORS? Are those new custom You must also render the template using RequestContext rather than Context in order for TEMPLATE_CONTEXT_PROCESSORS to be run. How

Re: {{ perms }} seems to be empty

2007-05-23 Thread Martin J Hsu
> 1. TEMPLATE_CONTEXT_PROCESSORS is not in my settings file. But the docs say > that its default is: ("django.core.context_processors.auth", etc... > That is correct: http://www.djangoproject.com/documentation/settings/#template-context-processors The default isn't explicitly defined in settin

Re: {{ perms }} seems to be empty

2007-05-23 Thread Martin J Hsu
> 1. TEMPLATE_CONTEXT_PROCESSORS is not in my settings file. But the docs say > that its default is: ("django.core.context_processors.auth", etc... > That is correct: http://www.djangoproject.com/documentation/settings/#template-context-processors The default isn't explicitly defined in settin

Re: {{ perms }} seems to be empty

2007-05-23 Thread Martin J Hsu
> 1. TEMPLATE_CONTEXT_PROCESSORS is not in my settings file. But the docs say > that its default is: ("django.core.context_processors.auth", etc... > That is correct: http://www.djangoproject.com/documentation/settings/#template-context-processors The default isn't explicitly defined in settin

Re: {{ perms }} seems to be empty

2007-05-23 Thread Mike Lake
Hi Aidas asked . > Is "django.core.context_processors.auth" set in your > TEMPLATE_CONTEXT_PROCESSORS? Are those new custom permissions in the > auth_permission table? If not - try to delete the test tables and > syncdb again. 1. TEMPLATE_CONTEXT_PROCESSORS is not in my settings file. But th

Re: {{ perms }} seems to be empty

2007-05-23 Thread Aidas Bendoraitis
Is "django.core.context_processors.auth" set in your TEMPLATE_CONTEXT_PROCESSORS? Are those new custom permissions in the auth_permission table? If not - try to delete the test tables and syncdb again. Regards, Aidas Bendoraitis aka Archatas On 5/23/07, Michael Lake <[EMAIL PROTECTED]> wrote: >

{{ perms }} seems to be empty

2007-05-22 Thread Michael Lake
Hi all I have a template and request is being passed to it and so I expected that {{ perms }} would be availablke as in Chap 12 of the Django book. I have this: Permissions: {% for permission in in request.user.get_all_permissions %} + {{ permission }} {% endfor %} {% if perms.lab %}