<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Overriding a Widget in the Django Admin Site, part 2</title>
	<atom:link href="http://www.fictitiousnonsense.com/archives/33/feed" rel="self" type="application/rss+xml" />
	<link>http://www.fictitiousnonsense.com/archives/33</link>
	<description>&#38; Wasted Ink</description>
	<lastBuildDate>Thu, 17 Feb 2011 15:59:54 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: zeitung online</title>
		<link>http://www.fictitiousnonsense.com/archives/33/comment-page-1#comment-103</link>
		<dc:creator>zeitung online</dc:creator>
		<pubDate>Tue, 25 May 2010 14:38:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.fictitiousnonsense.com/?p=33#comment-103</guid>
		<description>YES. You make my day. Thx. I will try to implement it in my mingus up.</description>
		<content:encoded><![CDATA[<p>YES. You make my day. Thx. I will try to implement it in my mingus up.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rick</title>
		<link>http://www.fictitiousnonsense.com/archives/33/comment-page-1#comment-70</link>
		<dc:creator>rick</dc:creator>
		<pubDate>Wed, 10 Jun 2009 02:33:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.fictitiousnonsense.com/?p=33#comment-70</guid>
		<description>Thanks, varikin. About whether markdown filter&#039;s efficiency, I guess that will be a todo for one of us :)

If it&#039;s not a big difference, it would be nicer to use the markdown filter, because you would only have one field in the database rather than two, which would just seem a little more elegant.

Anyway, I think I got it all working! Thanks for the help!</description>
		<content:encoded><![CDATA[<p>Thanks, varikin. About whether markdown filter&#8217;s efficiency, I guess that will be a todo for one of us :)</p>
<p>If it&#8217;s not a big difference, it would be nicer to use the markdown filter, because you would only have one field in the database rather than two, which would just seem a little more elegant.</p>
<p>Anyway, I think I got it all working! Thanks for the help!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: varikin</title>
		<link>http://www.fictitiousnonsense.com/archives/33/comment-page-1#comment-69</link>
		<dc:creator>varikin</dc:creator>
		<pubDate>Wed, 10 Jun 2009 02:18:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.fictitiousnonsense.com/?p=33#comment-69</guid>
		<description>Hi Rick,

You are busy with this:)

I escaped the HTML because I didn&#039;t want anything but what I generated through the markdown syntax. So I did not want to unescape it.

The safe filter it more efficient than the markdown filter because it just tells Django &quot;this text is already safe, you don&#039;t have to escape anything&quot;. Where as the markdown filter will convert markdown text to HTML when rendering the template. I haven&#039;t done any profiling between the two, but I would hope the safe filter is faster.

I hope this helps.</description>
		<content:encoded><![CDATA[<p>Hi Rick,</p>
<p>You are busy with this:)</p>
<p>I escaped the HTML because I didn&#8217;t want anything but what I generated through the markdown syntax. So I did not want to unescape it.</p>
<p>The safe filter it more efficient than the markdown filter because it just tells Django &#8220;this text is already safe, you don&#8217;t have to escape anything&#8221;. Where as the markdown filter will convert markdown text to HTML when rendering the template. I haven&#8217;t done any profiling between the two, but I would hope the safe filter is faster.</p>
<p>I hope this helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rick</title>
		<link>http://www.fictitiousnonsense.com/archives/33/comment-page-1#comment-68</link>
		<dc:creator>rick</dc:creator>
		<pubDate>Wed, 10 Jun 2009 01:59:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.fictitiousnonsense.com/?p=33#comment-68</guid>
		<description>OK. I found the safe filter, but is the safe filter much more efficient than the markdown filter?</description>
		<content:encoded><![CDATA[<p>OK. I found the safe filter, but is the safe filter much more efficient than the markdown filter?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rick</title>
		<link>http://www.fictitiousnonsense.com/archives/33/comment-page-1#comment-67</link>
		<dc:creator>rick</dc:creator>
		<pubDate>Wed, 10 Jun 2009 01:55:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.fictitiousnonsense.com/?p=33#comment-67</guid>
		<description>I just noticed that even if I remove the escape() call, it&#039;s still escaping all the HTML. Does Django do this automatically?</description>
		<content:encoded><![CDATA[<p>I just noticed that even if I remove the escape() call, it&#8217;s still escaping all the HTML. Does Django do this automatically?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rick</title>
		<link>http://www.fictitiousnonsense.com/archives/33/comment-page-1#comment-66</link>
		<dc:creator>rick</dc:creator>
		<pubDate>Wed, 10 Jun 2009 01:45:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.fictitiousnonsense.com/?p=33#comment-66</guid>
		<description>OK i found outhow to hide the html_body filed by using exclude = (&#039;html_body&#039;,) in the PostAdmin class.

But I have another issue.

Because you escape the markdown like this:

return markdown(escape(raw))

When I try to display it in the template it shows escaped HTML. As far as I know there is no unescape function in django.utils, so how do you get it back to regular HTML?

Also if you need to filter it again or process it again to unescape it back to HTML, doesn&#039;t that add processing that is similar to using the markdown filter in the template if you had just saved it as markdown? In other words, aren&#039;t you trading one overhead for another?</description>
		<content:encoded><![CDATA[<p>OK i found outhow to hide the html_body filed by using exclude = (&#8216;html_body&#8217;,) in the PostAdmin class.</p>
<p>But I have another issue.</p>
<p>Because you escape the markdown like this:</p>
<p>return markdown(escape(raw))</p>
<p>When I try to display it in the template it shows escaped HTML. As far as I know there is no unescape function in django.utils, so how do you get it back to regular HTML?</p>
<p>Also if you need to filter it again or process it again to unescape it back to HTML, doesn&#8217;t that add processing that is similar to using the markdown filter in the template if you had just saved it as markdown? In other words, aren&#8217;t you trading one overhead for another?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rick</title>
		<link>http://www.fictitiousnonsense.com/archives/33/comment-page-1#comment-65</link>
		<dc:creator>rick</dc:creator>
		<pubDate>Wed, 10 Jun 2009 01:14:56 +0000</pubDate>
		<guid isPermaLink="false">http://www.fictitiousnonsense.com/?p=33#comment-65</guid>
		<description>&quot;By the way, I am not displaying html_body field on the admin change/add page.&quot;

varikin, how do you hide the html_body field?

thanks.</description>
		<content:encoded><![CDATA[<p>&#8220;By the way, I am not displaying html_body field on the admin change/add page.&#8221;</p>
<p>varikin, how do you hide the html_body field?</p>
<p>thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ed</title>
		<link>http://www.fictitiousnonsense.com/archives/33/comment-page-1#comment-58</link>
		<dc:creator>Ed</dc:creator>
		<pubDate>Thu, 04 Jun 2009 02:29:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.fictitiousnonsense.com/?p=33#comment-58</guid>
		<description>I just found this post and it solved my problems I mentioned in the comment in the previous post. Just goes to show what a little digging effort can do before automatically asking questions.

I ended up extending this a bit by using a render_to_response with a very simple template that included my typesetting css file so that the preview ends up being typeset like it will when actually posted.

Thanks again for this info, it has been very helpful.</description>
		<content:encoded><![CDATA[<p>I just found this post and it solved my problems I mentioned in the comment in the previous post. Just goes to show what a little digging effort can do before automatically asking questions.</p>
<p>I ended up extending this a bit by using a render_to_response with a very simple template that included my typesetting css file so that the preview ends up being typeset like it will when actually posted.</p>
<p>Thanks again for this info, it has been very helpful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: varikin</title>
		<link>http://www.fictitiousnonsense.com/archives/33/comment-page-1#comment-48</link>
		<dc:creator>varikin</dc:creator>
		<pubDate>Wed, 20 May 2009 20:38:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.fictitiousnonsense.com/?p=33#comment-48</guid>
		<description>@Jesús Gómez - The safe filter servers a different need than escaping in the code. The escaping was to remove any HTML written into the raw_body before converting the markup to HTML. This prevented malicious code. Then the final html_body contains only HTML created by the markup. Then the safe filter in the template tells the template engine that it does not need to escape any further because you have already ensured it is safe.</description>
		<content:encoded><![CDATA[<p>@Jesús Gómez &#8211; The safe filter servers a different need than escaping in the code. The escaping was to remove any HTML written into the raw_body before converting the markup to HTML. This prevented malicious code. Then the final html_body contains only HTML created by the markup. Then the safe filter in the template tells the template engine that it does not need to escape any further because you have already ensured it is safe.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jesús Gómez</title>
		<link>http://www.fictitiousnonsense.com/archives/33/comment-page-1#comment-47</link>
		<dc:creator>Jesús Gómez</dc:creator>
		<pubDate>Wed, 20 May 2009 20:04:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.fictitiousnonsense.com/?p=33#comment-47</guid>
		<description>I had to apply the safe filter at the html_body content in the templates. It looks like appling escape in the code is not enough.</description>
		<content:encoded><![CDATA[<p>I had to apply the safe filter at the html_body content in the templates. It looks like appling escape in the code is not enough.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

