The model:
class Panel(models.Model):
loc = models.IntegerField()
title = models.CharField(max_length=200)
def __unicode__(self):
return self.title
The template is supplied with Panel instances from the view:
def index(request):
return render_to_response('application/index.html',
{"DEBUG": True,
"panels": Panel.objects.all() },
context_instance=RequestContext(request))
The template attempts to access a specific model instance as follows:
{% with panel = panels[1] %}
...presentation logic....
{% endwith %}
Currently this results in
TemplateSyntaxError at /applicatino/
u’with’ expected at least one variable assignment
You can access the panel using
panels.1in your template, like this: