On 4/3/07, Grupo Django <[EMAIL PROTECTED]> wrote:
> Inside the custom template tag, I don't get the request object since
> it's not a view.

Look into using RequestContext[1] in your views (generic views all use
it automatically), and enabling the "request" context processor[2].
This will make the variable "request" -- containing the HttpRequest
object -- available in template contexts, so in your tag's 'render'
method you could access it by doing something like:

def render(self, context);
    request = template.resolve_variable('request', context)
    ...do stuff with the request...

[1] 
http://www.djangoproject.com/documentation/templates_python/#subclassing-context-requestcontext
[2] 
http://www.djangoproject.com/documentation/templates_python/#django-core-context-processors-request

-- 
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to