On Nov 17, 9:28 am, neridaj <neri...@gmail.com> wrote:
> I can't figure out why my comment vars aren't available in my
> template. I'm using django.contrib.markup and when I try to preview
> the comments nothing is displayed, however, the comment var is
> available in {{ comment|linebreaks }} but not in
> {{ comment.submit_date|date:"F j, Y" }}, {{ comment.person_name }} or
> {{ comment.comment|markdown:"safe" }}. Does anyone see what I'm doing
> wrong?
>
> code for preview.html:
>
>  {% load comments %}
>   <form id="comment-form" class="comment-form" action="{%
> comment_form_target %}" method="post">
>     {% if next %}<input type="hidden" name="next" value="{{ next }}" />
> {% endif %}
>     {% if form.errors %}
>     <h1>{% blocktrans count form.errors|length as counter %}Please
> correct the error below{% plural %}Please correct the errors below{%
> endblocktrans %}</h1>
>     {% else %}
>     <h4>{% trans "Preview your comment" %}</h4>
>       <blockquote>{{ comment|linebreaks }}</blockquote>
> {% load markup %}
> <h2>Post a comment</h2>
> <p>Here's how your comment will look:</p>
> <p>On {{ comment.submit_date|date:"F j, Y" }},
> {{ comment.person_name }} said:</p>
> {{ comment.comment|markdown:"safe" }}
>
> Thanks,
>
> J

Since {{ comment|linebreaks }} works, I would guess that the object
'comment' is not the comment instance, but simply the text of the
comment. If this is a template meant to be used in the standard
comment preview view, there is no comment instance at that point
because it hasn't been saved yet. See the code in
django.contrib.comments.views.comments.

--
DR.

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.


Reply via email to