Hi.

You want to look at template context processors.

http://docs.djangoproject.com/en/dev/ref/templates/api/#subclassing-context-requestcontext

You can create your own context processors or use the built in. These
can provide access to the current request in your template… and
therefore request.user.is_authenticated (or something like that) :)

hope it helps

pete


On 26 Dec., 09:05, Igor Artamonov <igor.artamo...@gmail.com> wrote:
> Hi
>
> I need to make an custom tag, for auth checks, based on data stored on
> cookies. Like a:
> {% if_loggen_in %}
> <span>Some message for logged in only user</span>
> {% end_if_logged_in %}
>
> btw, i don't know how to get access to request object in my tag. I know that
> there is 'inclusion tags', but as you see there is nothing to include, my
> tag just renders data based on current request data.
>
> I know about .request middleware and RequestContext class, but this tag can
> be used anywhere (and at least it used in main layout, so it used in every
> page), so the way when I use RequestContext(context) in every possible view
> is too complex.
>
> How can i get access to it from custom tag? Can i make it use RequestContext
> by default?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to