Hi, I have a view called home that searches for a user in my UserProfile model and returns the username. I add this username to the context variable and try to show it in the template. Pretty straightforward and simple, right? Well, here is my code first :
def home(request): var = "" n = None if request.method == u'GET': GET = request.GET if GET.has_key(u'name'): n = GET[u'name'] try: user = UserProfile.objects.get(facebookId = n) user.is_active = True user.last_login = datetime.now() var = user.facebookId user.save() print var #on log out if GET.has_key(u'logout'): print 'im logging out!' user = UserProfile.objects.get(facebookId = n) user.is_active = False user.last_login = datetime.now() user.save() except: user = UserProfile(facebookId=n,playedHours=0, is_active=True) user.save() print var context = {'nom':var} return render_to_response('home.html',context,context_instance=RequestContext(request)) and in my template I have something as simple as : {{ nom }} However, when I replace *var* with a "bla bla bla" for example, it shows on my template, but when I pass a variable name to the context, it doesn't show ! I also can see the *var* value on my console (notice i'm using print twice or thrice in the code) am I doing anything wrong here? Thanks ! -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/fiNfWVrhf0AJ. To post to this group, send email to django-users@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.