Your code looks ok, but something is obviously wrong, you'll need to
debug this to figure out what's going wrong.

Here are some quick ideas of how to go about debugging it—if at any
point something looks or works contrary to what you'd expect then try
to figure out why that's happening and you'll probably solve this
problem:

1. in your view after you declare vars, add in something like: "raise
Exception(vars)" (with DEBUG=True in your settings file) to see what
your user object is and make sure that "vars" looks ok
2. in your template - move the <h3>{{ section }}</h3> outside of the
{% if %} statement and see if it shows
3. you can put some static text next to the variable that you know
should show up on your rendered page to make sure that it's getting
rendered by the template, like: "!TEST{{ section }}TEST!"
4. look at the html source to make sure your css or js isn't hiding
stuff or doing weird things
5. make sure that your parent template "gen_temp.html" actually has a
block called "content"
6. if nothing is working, maybe even just try (as a sanity check)
rendering a template that contains nothing but "{{ section }}"

It's probably something like a typo somewhere, but you'll have to
debug this yourself. Good luck!

--
Peter

On Sep 14, 1:40 pm, Dan06 <dan.king...@yahoo.com> wrote:
> Hi,
>
> Below is a function I created in my views.py file and its accompanying
> template file. For some reason, the second Name-Value Pair i.e.
> 'section':'General Info' does not render in the respective template
> file. Anyone know what is wrong? Thanks.
>
> def lookup(request, first_name, last_name):
>         user = Registrations.objects.get(last_name = last_name, first_name =
> first_name)
>         vars = { 'user' : user, 'section': 'General Info' }
>         return render_to_response('lookup.html', vars)
>
> # lookup.html template file
> {% extends "gen_temp.html" %}
>
> {% block title %}Lookup Search{% endblock %}
>
> {% block content %}
>         {% if user %}
>                 <h3>{{ section }}</h3>
>                 <p>Your lookup search was for: {{ user.first_name }}
> {{ user.last_name }}</p>
>                 <p>{{ user.first_name }} can be reached at: {{ user.email 
> }}</p>
>         {% endif %}
> {% endblock %}
>
> -Dan
--~--~---------~--~----~------------~-------~--~----~
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 
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