Tuesday, October 27, 2015

Safe tag is working differently for different view.

I am having two views both are extending from same base.html and both of them have loaded same template tags, but one is escaping string using safe and other is not what could be 
Code 

view 1
{% extends 'base.html' %}
{% load inplace_edit mezzanine_tags rating_tags keyword_tags comment_tags nano_tags staticfiles %}
...
{% comments_for object %}
...
view 2
{% extends "base.html" %}
{% load inplace_edit mezzanine_tags comment_tags keyword_tags nano_tags i18n future staticfiles %}
...
{% comments_for blog_post %}
...

view3 (comment.html)
{% load i18n mezzanine_tags comment_tags  nano_tags future %}
...
<div class="comment-description">{{ comment.comment|safe  }}</div>
...

As we can see both view 1 and 2 are using same function so it would be using same template but in view2 safe is working and in view1 it's not working.

What could be the reason for this ?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/001c1a9d-ae7f-4992-86f3-e72046d5212d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment