Reputation: 2699
The template is rendering this:
Hello, [<Student: Bob Frediricko>]. How are you?
But I want it to render:
Hello, Bob. How are you?
The view does this:
q = Student.objects.filter(pk=1)
for f in survey_formset:
f.helper.layout = Layout(HTML("""
Hello, {{ q }}. How are you?
"""))
the student model has...
def __unicode__ (self):
return smart_unicode(self.first_name+" "+self.last_name)
Thanks for the help :]
Upvotes: 1
Views: 47
Reputation: 18467
filter
returns a list, which is what you are seeing stringified in your rendered template.
Try this instead:
q = Student.objects.filter(pk=1)[0]
Or better yet, since you are selecting by pk (which is unique):
q = Student.objects.get(pk=1)
Upvotes: 2