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
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 (
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)
> 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
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
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
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 %}
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
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
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
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
> 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
> 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
> 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
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
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:
>
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 %}
17 matches
Mail list logo