<?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>Комментарии на: direct_to_template вместо render_to_response</title>
	<atom:link href="http://djangonaut.ru/2009/08/23/direct_to_template-instead-of-render_to_response/feed/" rel="self" type="application/rss+xml" />
	<link>http://djangonaut.ru/2009/08/23/direct_to_template-instead-of-render_to_response/</link>
	<description>django tips &#38; tricks</description>
	<pubDate>Sun, 20 May 2012 06:59:25 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>От: Как передать параметр?</title>
		<link>http://djangonaut.ru/2009/08/23/direct_to_template-instead-of-render_to_response/comment-page-1/#comment-2877</link>
		<dc:creator>Как передать параметр?</dc:creator>
		<pubDate>Thu, 03 Nov 2011 07:18:20 +0000</pubDate>
		<guid isPermaLink="false">http://djangonaut.ru/?p=43#comment-2877</guid>
		<description>[...] 03.11.2011   0    0        Semirook, @render_to из django-annoying - тоже не совсем хорошо, потому как меняется тип возвращаемой информации. Уж лучше использовать direct_to_template - http://djangonaut.ru/2009/08/23/direct_to_template-instead-of-render_to_response/ [...]</description>
		<content:encoded><![CDATA[<p>[...] 03.11.2011   0    0        Semirook, @render_to из django-annoying - тоже не совсем хорошо, потому как меняется тип возвращаемой информации. Уж лучше использовать direct_to_template - <a href="http://djangonaut.ru/2009/08/23/direct_to_template-instead-of-render_to_response/" rel="nofollow">http://djangonaut.ru/2009/08/23/direct_to_template-instead-of-render_to_response/</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>От: finn</title>
		<link>http://djangonaut.ru/2009/08/23/direct_to_template-instead-of-render_to_response/comment-page-1/#comment-235</link>
		<dc:creator>finn</dc:creator>
		<pubDate>Tue, 01 Sep 2009 04:43:20 +0000</pubDate>
		<guid isPermaLink="false">http://djangonaut.ru/?p=43#comment-235</guid>
		<description>2Gerlion: в туториале render_to_response() зовется только с двумя параметрами: именем шаблона и словарем с данными.  Третий, необязательный параметр, не показан.  При таком раскладе в шаблоне будут недоступны данные, которые подставляют context processors.  Примечание по этому поводу есть прямо в &lt;a href="http://docs.djangoproject.com/en/dev/ref/templates/api/#id1" rel="nofollow"&gt;доке на RequestContext&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>2Gerlion: в туториале render_to_response() зовется только с двумя параметрами: именем шаблона и словарем с данными.  Третий, необязательный параметр, не показан.  При таком раскладе в шаблоне будут недоступны данные, которые подставляют context processors.  Примечание по этому поводу есть прямо в <a href="http://docs.djangoproject.com/en/dev/ref/templates/api/#id1" rel="nofollow">доке на RequestContext</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>От: finn</title>
		<link>http://djangonaut.ru/2009/08/23/direct_to_template-instead-of-render_to_response/comment-page-1/#comment-234</link>
		<dc:creator>finn</dc:creator>
		<pubDate>Mon, 31 Aug 2009 22:05:36 +0000</pubDate>
		<guid isPermaLink="false">http://djangonaut.ru/?p=43#comment-234</guid>
		<description>2uptimebox: Так все равно надо импортировать RequestContext.

Ну и работать оно будет по счастливой случайности - RequestContext прикидывается словарем.  По-хорошему надо бы писать так:

&lt;pre&gt;&lt;code&gt;render_to_response(’my_template.html’, {},
                   RequestContext(request,
                                  {’object_list’: SomeModel.objects.all()}))&lt;/code&gt;&lt;/pre&gt;

Или, что то же самое, но логичнее:

&lt;pre&gt;&lt;code&gt;render_to_response(’my_template.html’,
                    {’object_list’: SomeModel.objects.all()},
                   RequestContext(request))&lt;/code&gt;&lt;/pre&gt;

А этот вариант фактически тот же самый, что в исходном посте, разве что RequestContext передается не через именованный параметр.</description>
		<content:encoded><![CDATA[<p>2uptimebox: Так все равно надо импортировать RequestContext.</p>
<p>Ну и работать оно будет по счастливой случайности - RequestContext прикидывается словарем.  По-хорошему надо бы писать так:</p>
<pre><code>render_to_response(’my_template.html’, {},
                   RequestContext(request,
                                  {’object_list’: SomeModel.objects.all()}))</code></pre>
<p>Или, что то же самое, но логичнее:</p>
<pre><code>render_to_response(’my_template.html’,
                    {’object_list’: SomeModel.objects.all()},
                   RequestContext(request))</code></pre>
<p>А этот вариант фактически тот же самый, что в исходном посте, разве что RequestContext передается не через именованный параметр.</p>
]]></content:encoded>
	</item>
	<item>
		<title>От: Gerlion</title>
		<link>http://djangonaut.ru/2009/08/23/direct_to_template-instead-of-render_to_response/comment-page-1/#comment-233</link>
		<dc:creator>Gerlion</dc:creator>
		<pubDate>Mon, 31 Aug 2009 21:51:47 +0000</pubDate>
		<guid isPermaLink="false">http://djangonaut.ru/?p=43#comment-233</guid>
		<description>А что не так, если использовать render_to_response так как написано в туториале?</description>
		<content:encoded><![CDATA[<p>А что не так, если использовать render_to_response так как написано в туториале?</p>
]]></content:encoded>
	</item>
	<item>
		<title>От: uptimebox</title>
		<link>http://djangonaut.ru/2009/08/23/direct_to_template-instead-of-render_to_response/comment-page-1/#comment-232</link>
		<dc:creator>uptimebox</dc:creator>
		<pubDate>Mon, 31 Aug 2009 21:03:05 +0000</pubDate>
		<guid isPermaLink="false">http://djangonaut.ru/?p=43#comment-232</guid>
		<description>А если итак:

render_to_response('my_template.html', RequestContext(request, {'object_list': SomeModel.objects.all()})</description>
		<content:encoded><![CDATA[<p>А если итак:</p>
<p>render_to_response(&#8217;my_template.html&#8217;, RequestContext(request, {&#8217;object_list&#8217;: SomeModel.objects.all()})</p>
]]></content:encoded>
	</item>
	<item>
		<title>От: Andrew</title>
		<link>http://djangonaut.ru/2009/08/23/direct_to_template-instead-of-render_to_response/comment-page-1/#comment-227</link>
		<dc:creator>Andrew</dc:creator>
		<pubDate>Mon, 31 Aug 2009 00:54:36 +0000</pubDate>
		<guid isPermaLink="false">http://djangonaut.ru/?p=43#comment-227</guid>
		<description>Это круто, я этого как-то не заметил. :-)
Все время использовал собственную версию.</description>
		<content:encoded><![CDATA[<p>Это круто, я этого как-то не заметил. <img src='http://djangonaut.ru/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
Все время использовал собственную версию.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

