I don't know if I didn't understand you or if I you didn't don't understand me :-) Not sure abou what you are saying, I think I can't use it to make the template tag work. The template tag doesn't use a view to render the content, so it doesn't get the request object as a parameter. This is the code of the template tag: ---------------------------------------------------------------------------------------------------------- register = template.Library() def menu(position):
data = request.session["stored_data"] ... return {'output': output,} register.inclusion_tag('menu/menu.html')(bloque_menu) ---------------------------------------------------------------------------------------------------------- So I need to read into data the data that is stored in the session. But the request object is not accessible. Sorry, I didn't understand what you wrote very good. Thank you. On 3 abr, 23:37, "James Bennett" <[EMAIL PROTECTED]> wrote: > 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/#subclass... > [2]http://www.djangoproject.com/documentation/templates_python/#django-c... > > -- > "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 -~----------~----~----~----~------~----~------~--~---