Saturday, October 15, 2011

Re: Clearly I do not understand something in templating

On Sat, Oct 15, 2011 at 8:51 AM, Piotr Hosowicz <phosowicz@gmail.com> wrote:
Hello,

This is in views.py :

def campaign(request, campaign_id):
   ctx = {'phones': PersonPhones.objects.all(), "camppeople":
CampPeople.objects.all() }
   return render_to_response("campaign.html", ctx,
context_instance=RequestContext(request))

This is the template :

<table>

{% for piplok in camppeople %}
{% if piplok.camppeople.docall %}

Based on your previous mail, CampPeople instances have a docall field. piplok is a CampPeople instance, since you have passed in a queryset of CampPeople in the 'camppeople' variable and are iterating through it in the for loop. So I expect this should be:

{% if piplo.docall %}

Karen
--
http://tracey.org/kmt/

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate