RajeshD wrote: > You could use: > > 1. a regular tag or > 2. an inclusion tag with takes_context=True > (See: > http://www.djangoproject.com/documentation/templates_python/#inclusion-tags) > > In both cases, your render or tag function will get called with a > context object from which you can obtain the request instance like so: > request = context['request'] (assuming that you have done the necessary > setup in your project to use a RequestContext instead of the default > Context) > > > > > Thanks for your lead, Rajesh. I followed your advice with this code:
from django.template import Library, Node from django.contrib.auth.models import User register = Library() def user_info(context): """ Get user and associated (if exists) profile information """ request = context['request'] user = User.objects.get(id = request.user.id) return { 'current_user': user, } register.inclusion_tag('user_info.html', takes_context=True)(user_info) But I receive multiple user objects. I guess my request context doesn't work --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---