On Thursday, December 23, 2010 10:23:40 AM UTC, MikeKJ wrote:
>
>
> re phrased heading as this is the real problem
>
> model:
> data = models.TextField(help_text='This is the embedding popup code for the
> video', null=True, blank=True)
>
> method:
> def data(self):
> return self.data
> data.allow_tags = True
>
> template:
> {% for v in x %}
> {{ v.data|safe }}
> {% endfor %}
>
> result:
> <bound method Video.data of <Video: Part 1 >>
>
> o/p on screen:
> >
>
> what I actually want is the output of data as html
>
> what am I missing here?
>
You have two attributes on your model called 'data'. One is the field, and
one is a method. Normally, when you reference a method in a template, Django
calls it automatically and uses the return value. However, it's possible
that because you have one name for two attributes, you've confused the
rendering engine. Try getting rid of the method altogether - it seems
irrelevant, since it just returns the value of the field - or at least
renaming it.
--
DR.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.