Skip to content
Browse files

corrected a few mistakes, explained better

  • Loading branch information...
1 parent 33f308c commit 4f996b93c888e24fbf77aca05cd79b72f9e5a5cf @tuxcanfly tuxcanfly committed Oct 19, 2010
Showing with 65 additions and 9 deletions.
  1. +15 −3 src/build/html/_sources/chapter5.txt
  2. +34 −2 src/build/html/chapter5.html
  3. +1 −1 src/build/html/searchindex.js
  4. +15 −3 src/source/chapter5.rst
View
18 src/build/html/_sources/chapter5.txt
@@ -182,7 +182,7 @@ To demonstrate custom model managers, we would like to show only 'published' art
Let's write down the models:
.. literalinclude:: djen_project/wiki/models.py
- :commit: f8603b3
+ :commit: 2070d53
Most of the code should be familiar, some things that are new:
@@ -202,14 +202,17 @@ Most of the code should be familiar, some things that are new:
the field name for the label. This can be overridden using ``verbose_name`` argument. ``help_text`` will be displayed below a field in
the rendered ``ModelForm``
+* The ``ordering`` attribute of meta class for ``Edit`` defines the default ordering in which ``edits`` will be returned. This can also be done
+ using ``order_by`` in the queryset.
+
Now, we will need urls similar to our previous app, plus we would need a url to see the article history.
.. literalinclude:: djen_project/wiki/urls.py
- :commit: 41bd9b3
+ :commit: 33f308c
Note that:
-* We will use the object_list generic views for the article index page and detail page.
+* We will use the ``list_detail`` generic views for the article index page and detail page.
* We have to autofill the ``author`` to the logged-in user, so will write a custom view for that.
@@ -240,6 +243,8 @@ In our custom views:
* ``edit_article`` includes two forms, one for the ``Article`` model and the other for the ``Edit`` model. We save both the forms one by one.
+* Passing ``instance`` to the form will populate existing data in the fields.
+
* As planned, the ``author`` field of ``article`` and ``editor``, ``article`` fields of ``Article`` and ``Edit`` respectively, are filled up
before commiting ``save``.
@@ -248,3 +253,10 @@ In our custom views:
* Note the ``filter`` on the ``Edit`` model's queryset and the ``lookup`` on the related ``Article's`` slug.
+To display all the articles on the index page:
+
+``wiki/templates/wiki/article_list.html``:
+
+.. literalinclude:: djen_project/wiki/templates/wiki/article_list.html
+ :language: django
+
View
36 src/build/html/chapter5.html
@@ -393,6 +393,9 @@
<span class="n">edited_on</span> <span class="o">=</span> <span class="n">models</span><span class="o">.</span><span class="n">DateTimeField</span><span class="p">(</span><span class="n">auto_now_add</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
<span class="n">summary</span> <span class="o">=</span> <span class="n">models</span><span class="o">.</span><span class="n">CharField</span><span class="p">(</span><span class="n">max_length</span><span class="o">=</span><span class="mi">100</span><span class="p">)</span>
+ <span class="k">class</span> <span class="nc">Meta</span><span class="p">:</span>
+ <span class="n">ordering</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;-edited_on&#39;</span><span class="p">]</span>
+
<span class="k">def</span> <span class="nf">__unicode__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="k">return</span> <span class="s">&quot;</span><span class="si">%s</span><span class="s"> - </span><span class="si">%s</span><span class="s"> - </span><span class="si">%s</span><span class="s">&quot;</span> <span class="o">%</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">summary</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">editor</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">edited_on</span><span class="p">)</span>
@@ -412,6 +415,8 @@
<li>We see the use of <tt class="docutils literal"><span class="pre">verbose_name</span></tt> and <tt class="docutils literal"><span class="pre">help_text</span></tt> keyword arguments. By default, django will replace <tt class="docutils literal"><span class="pre">_</span></tt> with spaces and Capitalize
the field name for the label. This can be overridden using <tt class="docutils literal"><span class="pre">verbose_name</span></tt> argument. <tt class="docutils literal"><span class="pre">help_text</span></tt> will be displayed below a field in
the rendered <tt class="docutils literal"><span class="pre">ModelForm</span></tt></li>
+<li>The <tt class="docutils literal"><span class="pre">ordering</span></tt> attribute of meta class for <tt class="docutils literal"><span class="pre">Edit</span></tt> defines the default ordering in which <tt class="docutils literal"><span class="pre">edits</span></tt> will be returned. This can also be done
+using <tt class="docutils literal"><span class="pre">order_by</span></tt> in the queryset.</li>
</ul>
<p>Now, we will need urls similar to our previous app, plus we would need a url to see the article history.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">django.conf.urls.defaults</span> <span class="kn">import</span> <span class="o">*</span>
@@ -428,7 +433,7 @@
<span class="n">url</span><span class="p">(</span><span class="s">r&#39;^article/(?P&lt;slug&gt;[-\w]+)$&#39;</span><span class="p">,</span>
<span class="s">&#39;django.views.generic.list_detail.object_detail&#39;</span><span class="p">,</span>
<span class="p">{</span>
- <span class="s">&#39;queryset&#39;</span><span class="p">:</span> <span class="n">Article</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">all</span><span class="p">(),</span>
+ <span class="s">&#39;queryset&#39;</span><span class="p">:</span> <span class="n">Article</span><span class="o">.</span><span class="n">published</span><span class="o">.</span><span class="n">all</span><span class="p">(),</span>
<span class="p">},</span>
<span class="n">name</span><span class="o">=</span><span class="s">&#39;wiki_article_detail&#39;</span><span class="p">),</span>
<span class="n">url</span><span class="p">(</span><span class="s">r&#39;^history/(?P&lt;slug&gt;[-\w]+)$&#39;</span><span class="p">,</span>
@@ -445,7 +450,7 @@
</div>
<p>Note that:</p>
<ul class="simple">
-<li>We will use the object_list generic views for the article index page and detail page.</li>
+<li>We will use the <tt class="docutils literal"><span class="pre">list_detail</span></tt> generic views for the article index page and detail page.</li>
<li>We have to autofill the <tt class="docutils literal"><span class="pre">author</span></tt> to the logged-in user, so will write a custom view for that.</li>
<li>Similarly, it would be better to write down custom views for edit article and article history pages.</li>
</ul>
@@ -475,6 +480,7 @@
<div class="highlight-python"><div class="highlight"><pre><span class="c"># Create your views here.</span>
<span class="kn">from</span> <span class="nn">django.contrib.auth.decorators</span> <span class="kn">import</span> <span class="n">login_required</span>
+<span class="kn">from</span> <span class="nn">django.contrib</span> <span class="kn">import</span> <span class="n">messages</span>
<span class="kn">from</span> <span class="nn">django.shortcuts</span> <span class="kn">import</span> <span class="n">redirect</span><span class="p">,</span> <span class="n">render_to_response</span><span class="p">,</span> <span class="n">get_object_or_404</span>
<span class="kn">from</span> <span class="nn">django.template</span> <span class="kn">import</span> <span class="n">RequestContext</span>
<span class="kn">from</span> <span class="nn">django.views.generic.list_detail</span> <span class="kn">import</span> <span class="n">object_list</span>
@@ -489,6 +495,8 @@
<span class="n">article</span> <span class="o">=</span> <span class="n">form</span><span class="o">.</span><span class="n">save</span><span class="p">(</span><span class="n">commit</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span>
<span class="n">article</span><span class="o">.</span><span class="n">author</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">user</span>
<span class="n">article</span><span class="o">.</span><span class="n">save</span><span class="p">()</span>
+ <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Article saved successfully&quot;</span>
+ <span class="n">messages</span><span class="o">.</span><span class="n">success</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">msg</span><span class="p">,</span> <span class="n">fail_silently</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
<span class="k">return</span> <span class="n">redirect</span><span class="p">(</span><span class="n">article</span><span class="p">)</span>
<span class="k">return</span> <span class="n">render_to_response</span><span class="p">(</span><span class="s">&#39;wiki/article_form.html&#39;</span><span class="p">,</span>
<span class="p">{</span> <span class="s">&#39;form&#39;</span><span class="p">:</span> <span class="n">form</span> <span class="p">},</span>
@@ -506,6 +514,8 @@
<span class="n">edit</span><span class="o">.</span><span class="n">article</span> <span class="o">=</span> <span class="n">article</span>
<span class="n">edit</span><span class="o">.</span><span class="n">editor</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">user</span>
<span class="n">edit</span><span class="o">.</span><span class="n">save</span><span class="p">()</span>
+ <span class="n">msg</span> <span class="o">=</span> <span class="s">&quot;Article updated successfully&quot;</span>
+ <span class="n">messages</span><span class="o">.</span><span class="n">success</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">msg</span><span class="p">,</span> <span class="n">fail_silently</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
<span class="k">return</span> <span class="n">redirect</span><span class="p">(</span><span class="n">article</span><span class="p">)</span>
<span class="k">return</span> <span class="n">render_to_response</span><span class="p">(</span><span class="s">&#39;wiki/article_form.html&#39;</span><span class="p">,</span>
<span class="p">{</span>
@@ -529,12 +539,34 @@
object based on url parameters (<tt class="docutils literal"><span class="pre">slug</span></tt>, <tt class="docutils literal"><span class="pre">id</span></tt> etc.)</li>
<li><tt class="docutils literal"><span class="pre">redirect</span></tt>, as we have seen, would issue a <tt class="docutils literal"><span class="pre">HttpResponseRedirect</span></tt> on the <tt class="docutils literal"><span class="pre">article's</span></tt> <tt class="docutils literal"><span class="pre">get_absolute_url</span></tt> property.</li>
<li><tt class="docutils literal"><span class="pre">edit_article</span></tt> includes two forms, one for the <tt class="docutils literal"><span class="pre">Article</span></tt> model and the other for the <tt class="docutils literal"><span class="pre">Edit</span></tt> model. We save both the forms one by one.</li>
+<li>Passing <tt class="docutils literal"><span class="pre">instance</span></tt> to the form will populate existing data in the fields.</li>
<li>As planned, the <tt class="docutils literal"><span class="pre">author</span></tt> field of <tt class="docutils literal"><span class="pre">article</span></tt> and <tt class="docutils literal"><span class="pre">editor</span></tt>, <tt class="docutils literal"><span class="pre">article</span></tt> fields of <tt class="docutils literal"><span class="pre">Article</span></tt> and <tt class="docutils literal"><span class="pre">Edit</span></tt> respectively, are filled up
before commiting <tt class="docutils literal"><span class="pre">save</span></tt>.</li>
<li><tt class="docutils literal"><span class="pre">article_history</span></tt> view first checks if an article with the given <tt class="docutils literal"><span class="pre">slug</span></tt> exists. If yes, it forwards the request to the <tt class="docutils literal"><span class="pre">object_list</span></tt> generic
view. We also pass the <tt class="docutils literal"><span class="pre">article</span></tt> from the generic view using <tt class="docutils literal"><span class="pre">extra_context</span></tt>.</li>
<li>Note the <tt class="docutils literal"><span class="pre">filter</span></tt> on the <tt class="docutils literal"><span class="pre">Edit</span></tt> model&#8217;s queryset and the <tt class="docutils literal"><span class="pre">lookup</span></tt> on the related <tt class="docutils literal"><span class="pre">Article's</span></tt> slug.</li>
</ul>
+<p>To display all the articles on the index page:</p>
+<p><tt class="docutils literal"><span class="pre">wiki/templates/wiki/article_list.html</span></tt>:</p>
+<div class="highlight-django"><div class="highlight"><pre><span class="cp">{%</span> <span class="k">if</span> <span class="nv">object_list</span> <span class="cp">%}</span><span class="x"></span>
+
+<span class="x">&lt;h2&gt;Recent Articles&lt;/h2&gt;</span>
+
+<span class="x">&lt;ul&gt;</span>
+<span class="x"> </span><span class="cp">{%</span> <span class="k">for</span> <span class="nv">article</span> <span class="k">in</span> <span class="nv">object_list</span> <span class="cp">%}</span><span class="x"></span>
+<span class="x"> &lt;li&gt;</span>
+<span class="x"> &lt;a href=&quot;</span><span class="cp">{%</span> <span class="k">url</span> <span class="nv">wiki_article_detail</span> <span class="nv">article.slug</span> <span class="cp">%}</span><span class="x">&quot;&gt;</span><span class="cp">{{</span> <span class="nv">article.title</span> <span class="cp">}}</span><span class="x">&lt;/a&gt;</span>
+<span class="x"> &lt;/li&gt;</span>
+<span class="x"> </span><span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span><span class="x"></span>
+<span class="x">&lt;/ul&gt;</span>
+
+<span class="cp">{%</span> <span class="k">else</span> <span class="cp">%}</span><span class="x"></span>
+<span class="x">&lt;h2&gt;No articles have been published yet.&lt;/h2&gt;</span>
+<span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span><span class="x"></span>
+
+<span class="x">&lt;a href=&quot;</span><span class="cp">{%</span> <span class="k">url</span> <span class="nv">wiki_article_add</span> <span class="cp">%}</span><span class="x">&quot;&gt;Create new article&lt;/a&gt;</span>
+</pre></div>
+</div>
</div>
</div>
View
2 src/build/html/searchindex.js
@@ -1 +1 @@
-Search.setIndex({objects:{},terms:{represent:9,all:[2,3,11,12,6,8,9],code:[2,3,7,12,6,10],forget:[8,9],maximum:9,get_object:8,queri:[2,8],forbidden:8,global:3,monti:8,month:11,signific:3,concept:12,runserv:[8,9],per:12,follow:[3,8,9],skeleton:[0,8],content:[3,0,11,8,9],cd_librari:[8,9],depend:[3,9],sensit:9,show:[3,11,12,8,9],specif:[3,8,9],send:[3,12,8],articl:[3,0],granular:[12,2],program:[5,8],swap:10,under:9,sens:2,get_and_delete_messag:6,introduc:[11,12,6,10,2],sourc:8,everi:[11,8],string:[11,8,9],far:[11,9],subcommand:[8,9],none:[3,11],ourself:11,util:9,fall:8,veri:8,affect:9,brows:3,charset:3,look:[3,11,8,9],contenttyp:[8,9],administr:[3,9],level:[12,6,10,2],did:9,metaclass:10,button:8,list:[2,11,12,6,8,9],upload:12,iter:[8,9],"try":[8,9],sane:9,localhost:9,get_templ:8,plain:3,cooki:11,admindoc:[3,11,8],div:[3,11,8],refer:[11,8,9],tempal:3,pleas:3,prevent:8,defaultfilt:[3,11],auth_group:9,core:[8,9],auth_group_permiss:9,cron:8,sync:9,focu:11,past:8,design:[0,8],pass:[3,11,8,9],download:[3,7],further:8,port:[4,9],blue:9,index:[3,0],what:[3,10,7,9],compar:7,repli:[3,6],abl:[3,11,8],brief:7,app_directori:8,delet:[8,9],version:7,primary_kei:9,basic:3,"new":[0,2,3,11,10,8,9],row:[11,8,9],method:[3,11,8,9],staff_member_requir:11,widget:[11,12,9],full:[8,9],abov:[8,9],whose:[11,8],autogener:[3,11,8,9],gener:[0,3,11,12,10,8,9],never:9,here:[3,11,12,6,10,8,9],bodi:3,shouldn:8,let:[3,11,8,9],free:[8,9],path:[11,8,9],becom:10,modifi:[11,8,9],sinc:[3,11,8,9],valu:[3,11,8,9],dry:[7,8,9],search:[0,9],convers:9,ahead:9,slugifi:[3,11],errornot:11,current:[8,9],genr:9,reason:3,"_set":11,datetim:8,amount:12,orm:[0,9,7,10,4],behav:8,social:[0,2],action:[3,11,6,8,9],implement:11,commonli:[0,8],overrid:[11,8],csrf_token:[3,11,8],via:12,requestcontext:[3,11,7],extra:[8,9],appli:8,app:[0,3,11,12,8,9],prefer:8,sevelet:[0,1],ask:9,api:9,blog:[3,0,8,11],instal:[3,7,9],updated_on__lt:8,middlewar:[6,7,2],regex:8,paste_detail:8,from:[3,4,5,1,10,8,9,11],helper:[11,8,9],would:[3,11,12,6,10,8,9],commun:[7,9],regist:[3,11,8,9],two:[3,11,8],next:[3,11,12,8,9],websit:[0,7,11,8,9],few:[11,8,9],stylesheet:11,book:[8,9],call:[3,11,8,9],recommend:9,dict:[11,8],noreversematch:8,checkout:9,until:[11,9],more:[12,2,8,9],chapter:[0,2,3,10,12,6,7,8,9,11],capit:[3,8],said:11,appendic:0,relat:[3,11,2,8,9],error_messag:11,notic:[3,8,9],site:[0,2,3,11,6,8,9],trail:3,indic:0,particular:[11,8],postgresql:9,hold:[3,11,9],wiki_article_index:3,easiest:9,must:[3,11,8,9],high:10,account:[3,11,8],graphic:12,retriev:9,restor:9,setup:[3,9],work:[12,6,10,8,9],uniqu:[11,9],dev:[3,8],histori:[3,7,9],column:9,remain:3,kwarg:[3,11],can:[3,11,8,9],analog:9,root:9,fetch:[3,11,8],def:[3,11,8,9],control:[6,8,9],sqlite:9,want:[11,6,8,9],give:[11,10,8,9],process:[3,8,9],registr:[3,11,8],smtp:3,templat:[0,3,10,5,7,8,11],topic:[0,2,3,11,12,6,10],tag:[3,10,7,8],login_requir:[3,4,11],date__year:9,pastebin_paste_detail:8,alwai:[8,9],django_sit:9,cours:[3,8,9],multipl:[11,9],save:[3,11,8,9],genre_choic:9,anoth:[11,10,8,9],object_list:[3,11,8],write:[3,0,8,11],till:6,"_confirm_delet":8,subdirectori:3,answer:[0,6],instead:[3,4,7,9],flow:8,csv:12,simpl:[3,8],css:[3,11],email_host:3,map:[3,11,5,1,8,9],jazz:9,recogn:9,lte:8,timedelta:8,dive:[12,6,2,8],after:[8,9],decor:[3,4,6,8,11],constraint:9,befor:[3,9],wrong:[3,9],scratch:3,auth_messag:9,codeignit:7,date:[0,11,9],philosophi:[7,8],data:[11,12,8,9],demonstr:3,permalink:[3,11,8],principl:[7,8,9],practic:8,third:8,condit:11,secur:[7,8],correspond:[11,8],greet:8,django:[0,2,3,4,5,1,7,8,9,10,11,12],issu:[3,7],inform:[3,9],"switch":9,maintain:[8,9],environ:9,allow:[3,12,8,9],enter:9,exclus:9,first:[3,8,9],egg:8,blog_post:11,oper:[8,9],ubernostrum:3,creation:8,help:[8,9],nonrel:7,over:[6,8],article_form:3,templatetag:[3,8],djen:0,post_delete_redirect:8,through:[3,2,9],nbsp:11,agiliq:8,hierarchi:3,still:3,paramet:[3,11,8],some:[3,11,10,8,9],group:[6,8,9],thank:9,fit:[3,2],how:[1,2,3,4,5,6,10,8,9,11,12],"_mysql_except":9,user_passes_test:11,better:[3,8],window:8,html:[3,11,8,9],mail:[3,12],hidden:11,main:11,might:4,easier:[8,9],finer:6,email_host_password:3,them:[3,11,8,9],good:[3,9],"return":[3,11,8,9],thei:[3,10,8,9],python:[3,7,8,9],similar:[3,8,9],auth_user_user_permiss:9,handi:9,auth:[3,11,8,9],scene:[10,9],framework:[3,7,8],getelementbyid:11,aesthet:8,verifi:9,front:3,now:[3,11,8,9],discuss:9,introduct:[0,9,7,4],choic:9,name:[3,11,8,9],get_object_or_404:[3,11],anyth:8,edit:[3,11,8,9],tran:11,refresh:9,separ:[8,9],accommod:9,mode:6,rock:9,debug:3,found:[3,8],updat:8,compatibl:7,mean:[8,9],harm:3,foreignkeymodel:11,replac:[3,8],hard:3,idea:9,appengin:[0,4],realli:[8,9],urlfield:11,redistribut:9,meta:[3,11],"static":8,expect:[11,9],year:[11,9],pastebin_paste_list:8,our:[3,0,11,8,9],special:9,out:[3,11,10,9],variabl:[3,8],accomplish:9,overridden:[3,11],base_sit:11,space:3,goe:10,publish:3,pgsql:9,rewrit:4,activation_kei:3,djangodesignpattern:8,suitabl:9,rel:[3,11,8],print:9,ref:[3,11,8],correct:8,common:[3,7,8],django_admin_log:9,urlpattern:[3,11,8],insid:[3,7,8],advanc:12,manipul:8,given:[3,8,9],object_detail:[3,8],email_use_tl:3,expiration_dai:3,base:[3,0,11,8,9],usual:8,put:[3,8],org:3,hand:9,care:[3,11,9],reusabl:[3,0,7,8,9],"_detail":8,wai:[3,11,8,9],where:[11,10,8,9],could:[3,8],omit:3,artilc:3,keep:[3,8,9],counterpart:8,thing:[3,11,10,8],length:9,mvc:9,place:[3,10,8,9],perman:11,outsid:3,unknown:9,charfield:[3,11,8,9],id_usernam:11,think:8,urlconf:8,lambda:11,feed:[11,12],respond:[8,9],requestsit:3,dont:8,directli:[3,8,9],template_nam:8,post_archive_month:11,onc:[8,9],wiki_article_add:3,number:[3,8,9],sometim:8,restrict:[11,12,9],mai:[3,11],instruct:9,alreadi:[11,8],done:[11,12,8],messag:[6,8,9],create_object:8,blank:[11,8,9],owner:11,installed_app:[3,11,8,9],open:[8,9],primari:[8,9],forgeri:8,differ:[4,5,6,9,1],convent:[11,8],script:[3,0,11,8,9],cutsom:6,top:3,demostr:3,least:9,blog_post_detail:11,max_length:[3,11,8,9],too:[8,9],deploy:9,similarli:[3,11,8],urlresolv:8,kid:9,doget:1,filter:[3,8,9],store:[3,11,12,8,9],includ:[3,11,7,8,9],shell:[8,9],option:[8,9],inspect:11,behind:[10,9],namespac:[3,9],get_absolute_url:[3,11,8],copi:11,cd_library_cd:9,specifi:[11,9],direct:8,auth_permiss:9,part:6,enclos:8,consult:3,comment_set:11,textfield:[3,11,8,9],sign:3,than:[12,8],rss:[11,12],serv:3,wide:[3,9],kind:9,keyword:3,instanc:[3,9],provid:[3,11,8,9],remov:9,arg_dict:8,templatedoesnotexist:8,structur:[7,8,9],charact:9,project:[0,12,11,8,9],merci:3,str:8,were:[6,8,9],stale:9,typic:8,browser:[11,9],sai:8,comput:9,well:[3,11,8,9],auto_incr:9,this_is_the_login_form:11,argument:[3,11,8,9],raw:9,expir:3,have:[3,11,12,6,8,9],close:11,need:[3,4,11,8,9],seen:[3,11,8],longtext:9,autodiscov:[3,11,8],automat:[3,11,8,9],engin:[10,9],built:[3,10,8,9],equival:8,self:[3,11,8,9],violat:8,object_id:8,click:3,note:[3,11,8,9],also:[3,11,8,9],builtin:8,preced:3,build:[0,2,3,11,12,6,8,9],which:[3,11,8,9],tupl:9,techniqu:2,subject:3,singl:[3,9],compat:7,begin:9,sure:[8,9],article_histori:3,thi:[0,2,3,11,12,10,8,9],shall:[3,11],usernam:[11,8,9],object:[3,11,8,9],oracl:9,chart:12,even:8,callabl:[11,8],render:[3,8],regular:8,jsp:[0,1],plan:3,deploi:9,pair:9,why:[4,7],amaz:3,doesnotexist:3,don:[3,8,9],textarea:[11,8],filesystem:8,url:[3,0,11,8,9],doc:[3,11,8],clear:[3,11,8],later:[8,9],cover:11,sessionid:11,doe:[11,10,8],declar:[10,8],clean:8,databas:[11,6,8,9],latest:8,fact:[8,9],criteria:[3,9],wsgi:9,accout:3,text:[3,11,8],sent:[3,12],extrastyl:11,view_post:11,session:[3,4,11,8,9],particularli:8,permiss:6,hack:[0,10],contrib:[3,11,8,9],find:[3,8],staff:11,redirect:[3,11,8],absolut:8,onli:[3,11,8,9],explicitli:[11,9],locat:8,post_archive_week:11,avaialb:3,transact:6,configur:[3,0,11,8,9],activ:3,enough:[8,9],should:[3,11,8,9],new_cd:9,dbshell:9,suppos:[11,8],analyz:11,hello_world:8,extra_context:3,local:8,oct:11,meant:8,contribut:9,variou:[6,2,8],get:[0,3,4,6,8,9,11],familiar:[3,9],django_templ:8,express:8,becaus:[3,11,8],amazon:12,cannot:8,emailfield:11,report:12,requir:[3,11,8,9],mapper:9,article__slug:3,enabl:[3,11,8,9],template_dir:8,artist:9,"public":11,twice:8,cach:[11,2],brush:8,integr:[11,12],though:[2,8],contain:[8,9],httpresponseforbidden:8,steal:11,old_past:8,view:[0,2,3,11,6,8,9],wiki:[3,0,8],set:[3,11,8,9],edit_articl:3,post_save_redirect:8,articleform:3,help_text:3,see:[3,11,2,8,9],date_bas:11,sec:9,result:9,paste_list:8,arg:[3,11],seo:11,labelcommand:8,calendar:9,add_articl:3,best:8,gmail:3,jqueri:3,flexibl:9,learnt:2,extend:[3,11,8],correctli:[3,9],down:[3,8,9],pattern:[3,11,8],someth:[3,11,8],admin_media_prefix:11,label:[3,11,8],written:[11,8],won:11,adminmedia:11,"import":[3,11,8,9],experi:9,email:[3,11,12],attribut:[11,9],publishedarticlesmanag:3,signatur:11,accord:[8,9],popup:9,parent:11,list_detail:[3,8],she:11,postgresql_psycopg2:9,add_post:11,wiki_article_detail:3,cycl:7,job:8,djen_project:[3,11,8,9],highlight:9,ipython:9,come:11,valid:[3,11,8,9],"__unicode__":[3,11,8,9],addit:[8,9],both:[3,8],protect:12,revers:[8,9],last:[3,11,8],admin:[3,11,8,9],django_sess:9,howev:[10,8],directori:[3,8,9],equal:9,foreign:11,javascript:11,etc:[3,7,8,9],folder:9,grain:6,context:[3,7,8],logic:8,logout:3,login:[3,11],com:[3,11,8],col:8,title__startswith:9,autofil:[3,11],load:[11,8],rehash:12,simpli:8,point:[3,0,11,8,9],overview:10,unittest:2,each:[11,10,8,9],wonder:8,slugfield:[3,11],walk:2,heirarchi:3,header:9,empti:[11,9],littl:9,commentform:11,exclud:[3,11,9],batteri:7,delete_object:8,backend:[3,11,2,8,9],quit:[3,11],pastebin_past:8,coupl:7,endif:[11,8],is_superus:11,been:8,account_activation_dai:3,secret:[3,9],much:8,direct_to_templ:8,interest:[8,9],certain:11,monthli:11,futur:7,popul:9,quickli:9,appcommand:8,registration_form:3,email_host_us:3,pri:9,summari:[3,9],cronjob:8,ani:[3,11,7,8,9],djen_databas:9,understand:9,togeth:[11,12,6,2,8],auth_us:9,child:[3,8],i18n:11,those:[3,8],"case":[8,9],"char":8,auth_user_group:9,noargscommand:8,blog_archive_month:11,packag:[3,11],webpag:8,tables_in_djen_databas:9,mount:8,properti:[3,11,8,9],aim:7,defin:[3,11,6,8,9],"while":[3,8,9],date__lt:9,publicli:8,error:[8,9],email_port:3,anonym:11,fixtur:8,observ:8,endblock:[3,11,8],view_funct:8,larger:12,update_object:8,readi:[7,8,9],modelform:[3,11,8],tabl:[3,0,11,8,9],non:3,worri:9,archiv:11,clutter:9,uncom:[3,11,8,9],conf:[3,11,8],lightweight:7,title__endswith:9,incom:8,revis:3,mani:[3,11,6],ship:[3,11,8,9],"__init__":[8,9],html2pdf:12,httprequest:8,complet:[3,9],is_publish:3,"null":[11,8,9],develop:9,welcom:[0,8],equiv:3,author:[3,11],perform:[11,2,8],make:[3,2,8,9],cross:8,same:[3,11,8],check:[3,9],member:11,handl:[3,11,8],complex:[12,8],edited_on:3,onclick:8,advis:9,autocr:8,document:[3,0,7,8,11],servelet:1,wiki_edit_detail:3,doctest:2,week:11,http:[3,11,6,8,9],webserv:8,rail:7,readonli:8,dai:[3,8],render_to_respons:[3,11,8],fairli:8,moment:3,rais:[8,9],temporari:11,initi:11,pdf:12,auto_now_add:[3,11,8],php:[0,5],respons:[3,7,8],chang:[3,11,8,9],tune:2,recent:8,audit:3,title__contain:9,appropri:11,"_list":8,older:8,entri:[3,0,11,8,9],markup:8,itself:9,except:8,inherit:8,datefield:9,person:[0,9],exampl:[3,11,6,10,8,9],command:8,endfor:[11,8],choos:8,programm:[0,5,1],model:[0,2,3,11,10,8,9],pastebin_paste_edit:8,rout:8,left:3,explan:9,comment:[3,11,9],construct:[4,5,1],identifi:11,just:[3,11,8,9],when:[2,3,11,6,8,9],verbose_nam:3,rest:[3,11,9],weekli:11,select:[2,8,9],genre__in:9,aspect:8,mysql:9,touch:8,glue:8,yet:8,languag:[5,8],httprespons:[8,9],bodyclass:11,easi:8,field:[3,11,8,9],interfer:3,pastebin_paste_delet:8,shortcut:[3,11,8],sqlite3:9,delete_old:8,add:[3,11,8,9],is_valid:[3,11],els:[11,8,9],tell:8,wiki_article_edit:3,modul:[0,8,9],match:[3,8],take:[11,8,9],applic:[0,2,3,12,8,9],django_content_typ:9,varchar:9,inlud:3,format:[3,12],auto_now:8,queryset:[3,11,8],crud:3,as_p:8,pop:9,loos:7,world:8,bit:9,loader:8,python3:7,desc:9,mainten:8,like:[0,3,10,6,7,8,9,11],success:8,date__gt:9,integ:8,server:[3,9],blog_add_post:11,href:[11,8],commit_manu:6,loop:9,output:[3,11,8],architectur:[7,9],manag:[0,3,11,12,8,9],underli:9,as_ul:8,www:8,drop:9,often:9,deal:9,simplifi:11,interact:9,postform:11,back:[4,8],understood:9,intern:[0,10],"export":12,authent:12,as_tabl:[3,11,8],respect:[3,8],proper:8,guarante:8,yesterdai:8,paste_confirm_delet:8,autocommit:6,kei:[3,11,8,9],txt:3,forcibl:3,djangoproject:[3,11,8],bottom:9,blog_archive_week:11,avoid:8,normal:8,subclass:[3,8,9],track:3,unord:8,larg:12,undon:8,slash:8,genrat:12,foo:[3,11,8],archive_week:11,operationalerror:9,either:[3,11,8],httpresponseredirect:[3,11,8],encourag:9,previou:[2,3,11,12,6,8],run:[3,8,9],autoincr:9,archive_month:11,host:9,isn:3,great:[3,8],although:3,post:[3,11,8],"super":[3,11],between:9,wiki_article_histori:3,simpler:8,edit_form:3,paste_form:8,about:[8,9],simplest:11,actual:[11,8],most:[3,11,8],syncdb:[3,8,9],endcom:3,startapp:[8,9],retain:3,page:[0,2,3,11,12,8,9],permission_requir:6,date_field:11,created_on:[3,11,8],constructor:8,fals:[3,11],commit:[3,11],backup:9,processor:7,block:[3,11,8],context_inst:[3,11],own:[8,9],within:9,sketch:[0,8],slug:[3,11],latter:8,pastebin:[3,0,8,11],right:3,activation_email:3,ensur:11,reli:8,soon:11,your:[3,11,8,9],extra_head:3,span:[11,8],log:[3,11,12,2],her:6,support:[3,9],question:6,id_password:11,submit:[3,11,8,9],custom:[3,0,11,8,9],avail:[3,12,9],start:[0,11,8,9],hef:8,interfac:[3,11,9],editor:3,lot:9,suit:8,forward:[3,8],submiss:8,create_upd:8,"function":[3,11,8,9],head:[3,8],doctyp:3,login_url:11,local_set:[3,9],form:[3,11,8,9],offer:3,poster:11,regard:3,link:[3,11,8],startproject:9,line:[3,11,8,9],"true":[3,11,8,9],editform:3,suppli:8,"throw":3,utf:3,input:[3,11,8],tab:9,possibl:9,whether:[3,11,9],type:[3,11,8,9],transactionmiddlewar:6,access:[11,12,8,9],displai:[3,11,8,9],get_query_set:3,record:9,below:[3,11,8],limit:11,capfirst:8,sampl:8,problem:12,booleanfield:3,app_path:11,featur:[11,7],pil:12,creat:[3,11,6,8,9],multipleobjectsreturn:9,"int":9,request:[3,11,6,7,8,9],dure:3,repres:[3,11,9],"_form":8,handle_noarg:8,exist:[3,8,9],file:[11,12,8,9],registration_activ:3,template_load:[3,8],ing:8,radiohead:9,fill:[3,11,8],again:[11,8,9],password:[11,12,9],content_titl:11,know:[3,8,9],titl:[3,11,9],user:[3,4,12,6,8,9,11],diveintopython:8,detail:[3,11,8],activation_email_subject:3,"default":[3,11,8,9],other:[3,4,1,7,8,9,11],lookup:[3,8,9],librari:[0,12,8,9],rememb:8,test:[11,2,8,9],tie:6,you:[3,4,10,8,9],roll:9,nice:3,resolut:9,condens:3,"class":[3,4,10,8,9,11],foreignkei:[3,11],yahoo:[0,6],breadcrumb:11,consid:[3,9],reduc:9,pastebin_paste_cr:8,bitbucket:3,backward:7,home:8,confirm:[8,9],descript:[10,9],hello:[11,8],came:8,time:[11,8,9],plu:3,updated_on:8,profil:[3,2],datetimefield:[3,11,8,9],daili:8},objtypes:{},titles:["Welcome to Djen of django&#8217;s documentation!","Django for the JSP/Sevelet programmer.","Chapter 8. Building a Social news Site","Chapter 5. Building a Wiki","Using Django with Appengine","Django for the PHP programmer","Chapter 6. Building a Yahoo Answer&#8217;s like site","Chapter 1: Introduction","Chapter 3. Building a Pastebin.","Chapter 2. Building a personal CD library.","Hacking Django internals.","Chapter 4. Building a Blog","Chapter 7. Building a Project management application"],objnames:{},filenames:["index","appendix3","chapter8","chapter5","appendix1","appendix2","chapter6","chapter1","chapter3","chapter2","appendix4","chapter4","chapter7"]})
+Search.setIndex({objects:{},terms:{represent:9,all:[2,3,11,12,6,8,9],code:[2,3,7,12,6,10],forget:[8,9],maximum:9,get_object:8,queri:[2,8],forbidden:8,global:3,monti:8,month:11,signific:3,concept:12,runserv:[8,9],per:12,follow:[3,8,9],skeleton:[0,8],content:[3,0,11,8,9],cd_librari:[8,9],depend:[3,9],sensit:9,show:[3,11,12,8,9],specif:[3,8,9],send:[3,12,8],articl:[3,0],granular:[12,2],program:[5,8],swap:10,under:9,sens:2,get_and_delete_messag:6,introduc:[11,12,6,10,2],sourc:8,everi:[11,8],string:[11,8,9],far:[11,9],subcommand:[8,9],none:[3,11],ourself:11,util:9,fall:8,veri:8,affect:9,brows:3,charset:3,look:[3,11,8,9],contenttyp:[8,9],administr:[3,9],level:[12,6,10,2],did:9,metaclass:10,button:8,list:[2,11,12,6,8,9],upload:12,iter:[8,9],"try":[8,9],sane:9,localhost:9,get_templ:8,plain:3,cooki:11,admindoc:[3,11,8],div:[3,11,8],refer:[11,8,9],tempal:3,pleas:3,prevent:8,defaultfilt:[3,11],auth_group:9,core:[8,9],auth_group_permiss:9,cron:8,sync:9,focu:11,past:8,design:[0,8],pass:[3,11,8,9],download:[3,7],further:8,port:[4,9],blue:9,index:[3,0],what:[3,10,7,9],compar:7,repli:[3,6],abl:[3,11,8],brief:7,app_directori:8,delet:[8,9],version:7,primary_kei:9,basic:3,"new":[0,2,3,11,10,8,9],row:[11,8,9],method:[3,11,8,9],staff_member_requir:11,widget:[11,12,9],full:[8,9],abov:[8,9],whose:[11,8],autogener:[3,11,8,9],gener:[0,3,11,12,10,8,9],never:9,here:[3,11,12,6,10,8,9],bodi:3,shouldn:8,let:[3,11,8,9],free:[8,9],path:[11,8,9],becom:10,modifi:[11,8,9],sinc:[3,11,8,9],valu:[3,11,8,9],dry:[7,8,9],search:[0,9],convers:9,ahead:9,slugifi:[3,11],errornot:11,current:[8,9],genr:9,reason:3,"_set":11,datetim:8,amount:12,orm:[0,9,7,10,4],behav:8,social:[0,2],action:[3,11,6,8,9],implement:11,commonli:[0,8],overrid:[11,8],csrf_token:[3,11,8],via:12,requestcontext:[3,11,7],extra:[8,9],appli:8,app:[0,3,11,12,8,9],prefer:8,sevelet:[0,1],ask:9,api:9,blog:[3,0,8,11],instal:[3,7,9],updated_on__lt:8,middlewar:[6,7,2],regex:8,paste_detail:8,from:[3,4,5,1,10,8,9,11],helper:[11,8,9],would:[3,11,12,6,10,8,9],commun:[7,9],regist:[3,11,8,9],two:[3,11,8],next:[3,11,12,8,9],websit:[0,7,11,8,9],few:[11,8,9],stylesheet:11,book:[8,9],call:[3,11,8,9],recommend:9,msg:3,dict:[11,8],noreversematch:8,checkout:9,until:[11,9],more:[12,2,8,9],chapter:[0,2,3,10,12,6,7,8,9,11],capit:[3,8],said:11,appendic:0,relat:[3,11,2,8,9],error_messag:11,notic:[3,8,9],site:[0,2,3,11,6,8,9],trail:3,indic:0,particular:[11,8],postgresql:9,hold:[3,11,9],wiki_article_index:3,easiest:9,must:[3,11,8,9],high:10,account:[3,11,8],graphic:12,retriev:9,restor:9,setup:[3,9],work:[12,6,10,8,9],uniqu:[11,9],dev:[3,8],histori:[3,7,9],column:9,remain:3,kwarg:[3,11],can:[3,11,8,9],analog:9,root:9,fetch:[3,11,8],def:[3,11,8,9],control:[6,8,9],sqlite:9,want:[11,6,8,9],give:[11,10,8,9],process:[3,8,9],registr:[3,11,8],smtp:3,templat:[0,3,10,5,7,8,11],topic:[0,2,3,11,12,6,10],tag:[3,10,7,8],login_requir:[3,4,11],date__year:9,pastebin_paste_detail:8,alwai:[8,9],django_sit:9,cours:[3,8,9],multipl:[11,9],save:[3,11,8,9],genre_choic:9,anoth:[11,10,8,9],object_list:[3,11,8],write:[3,0,8,11],till:6,"_confirm_delet":8,subdirectori:3,answer:[0,6],instead:[3,4,7,9],flow:8,csv:12,simpl:[3,8],css:[3,11],email_host:3,map:[3,11,5,1,8,9],jazz:9,recogn:9,lte:8,timedelta:8,dive:[12,6,2,8],after:[8,9],decor:[3,4,6,8,11],constraint:9,befor:[3,9],wrong:[3,9],scratch:3,auth_messag:9,codeignit:7,date:[0,11,9],philosophi:[7,8],data:[3,11,12,8,9],demonstr:3,permalink:[3,11,8],principl:[7,8,9],practic:8,third:8,condit:11,secur:[7,8],correspond:[11,8],greet:8,django:[0,2,3,4,5,1,7,8,9,10,11,12],issu:[3,7],inform:[3,9],"switch":9,maintain:[8,9],environ:9,allow:[3,12,8,9],enter:9,exclus:9,first:[3,8,9],egg:8,order:3,blog_post:11,oper:[8,9],ubernostrum:3,creation:8,help:[8,9],nonrel:7,over:[6,8],article_form:3,templatetag:[3,8],djen:0,post_delete_redirect:8,through:[3,2,9],nbsp:11,agiliq:8,hierarchi:3,still:3,paramet:[3,11,8],some:[3,11,10,8,9],group:[6,8,9],thank:9,fit:[3,2],how:[1,2,3,4,5,6,10,8,9,11,12],"_mysql_except":9,user_passes_test:11,better:[3,8],window:8,html:[3,11,8,9],mail:[3,12],hidden:11,main:11,might:4,easier:[8,9],finer:6,email_host_password:3,them:[3,11,8,9],good:[3,9],"return":[3,11,8,9],thei:[3,10,8,9],python:[3,7,8,9],similar:[3,8,9],auth_user_user_permiss:9,handi:9,auth:[3,11,8,9],scene:[10,9],framework:[3,7,8],getelementbyid:11,aesthet:8,verifi:9,front:3,now:[3,11,8,9],discuss:9,introduct:[0,9,7,4],choic:9,name:[3,11,8,9],get_object_or_404:[3,11],anyth:8,edit:[3,11,8,9],tran:11,refresh:9,separ:[8,9],accommod:9,mode:6,rock:9,debug:3,found:[3,8],updat:[3,8],compatibl:7,mean:[8,9],harm:3,foreignkeymodel:11,replac:[3,8],hard:3,idea:9,appengin:[0,4],realli:[8,9],urlfield:11,redistribut:9,meta:[3,11],"static":8,expect:[11,9],year:[11,9],pastebin_paste_list:8,our:[3,0,11,8,9],special:9,out:[3,11,10,9],variabl:[3,8],accomplish:9,overridden:[3,11],base_sit:11,space:3,goe:10,publish:3,pgsql:9,rewrit:4,activation_kei:3,djangodesignpattern:8,suitabl:9,rel:[3,11,8],print:9,ref:[3,11,8],correct:8,common:[3,7,8],django_admin_log:9,urlpattern:[3,11,8],insid:[3,7,8],advanc:12,manipul:8,given:[3,8,9],object_detail:[3,8],email_use_tl:3,expiration_dai:3,base:[3,0,11,8,9],usual:8,put:[3,8],org:3,hand:9,care:[3,11,9],reusabl:[3,0,7,8,9],"_detail":8,wai:[3,11,8,9],where:[11,10,8,9],could:[3,8],omit:3,artilc:3,keep:[3,8,9],counterpart:8,thing:[3,11,10,8],length:9,mvc:9,place:[3,10,8,9],perman:11,outsid:3,unknown:9,charfield:[3,11,8,9],id_usernam:11,think:8,urlconf:8,lambda:11,feed:[11,12],respond:[8,9],requestsit:3,dont:8,directli:[3,8,9],template_nam:8,post_archive_month:11,onc:[8,9],wiki_article_add:3,number:[3,8,9],sometim:8,restrict:[11,12,9],mai:[3,11],instruct:9,alreadi:[11,8],done:[3,11,12,8],messag:[3,6,8,9],create_object:8,blank:[11,8,9],owner:11,installed_app:[3,11,8,9],open:[8,9],primari:[8,9],forgeri:8,differ:[4,5,6,9,1],convent:[11,8],script:[3,0,11,8,9],cutsom:6,top:3,demostr:3,least:9,blog_post_detail:11,max_length:[3,11,8,9],order_bi:3,too:[8,9],deploy:9,similarli:[3,11,8],urlresolv:8,kid:9,doget:1,filter:[3,8,9],store:[3,11,12,8,9],includ:[3,11,7,8,9],shell:[8,9],option:[8,9],inspect:11,behind:[10,9],namespac:[3,9],get_absolute_url:[3,11,8],copi:11,cd_library_cd:9,specifi:[11,9],direct:8,auth_permiss:9,part:6,enclos:8,consult:3,comment_set:11,textfield:[3,11,8,9],sign:3,than:[12,8],rss:[11,12],serv:3,wide:[3,9],kind:9,keyword:3,instanc:[3,9],provid:[3,11,8,9],remov:9,arg_dict:8,templatedoesnotexist:8,structur:[7,8,9],charact:9,project:[0,12,11,8,9],merci:3,str:8,were:[6,8,9],stale:9,typic:8,browser:[11,9],sai:8,comput:9,well:[3,11,8,9],auto_incr:9,this_is_the_login_form:11,argument:[3,11,8,9],raw:9,expir:3,have:[3,11,12,6,8,9],close:11,need:[3,4,11,8,9],seen:[3,11,8],longtext:9,autodiscov:[3,11,8],automat:[3,11,8,9],engin:[10,9],built:[3,10,8,9],equival:8,self:[3,11,8,9],violat:8,object_id:8,click:3,note:[3,11,8,9],also:[3,11,8,9],builtin:8,preced:3,build:[0,2,3,11,12,6,8,9],which:[3,11,8,9],tupl:9,techniqu:2,subject:3,singl:[3,9],compat:7,begin:9,sure:[8,9],article_histori:3,thi:[0,2,3,11,12,10,8,9],shall:[3,11],usernam:[11,8,9],object:[3,11,8,9],oracl:9,chart:12,even:8,callabl:[11,8],render:[3,8],regular:8,jsp:[0,1],plan:3,deploi:9,pair:9,why:[4,7],amaz:3,doesnotexist:3,don:[3,8,9],textarea:[11,8],filesystem:8,url:[3,0,11,8,9],doc:[3,11,8],clear:[3,11,8],later:[8,9],cover:11,sessionid:11,doe:[11,10,8],declar:[10,8],clean:8,databas:[11,6,8,9],latest:8,fact:[8,9],criteria:[3,9],wsgi:9,accout:3,text:[3,11,8],sent:[3,12],extrastyl:11,view_post:11,session:[3,4,11,8,9],particularli:8,permiss:6,hack:[0,10],contrib:[3,11,8,9],find:[3,8],staff:11,redirect:[3,11,8],absolut:8,onli:[3,11,8,9],explicitli:[11,9],locat:8,post_archive_week:11,avaialb:3,transact:6,configur:[3,0,11,8,9],activ:3,enough:[8,9],should:[3,11,8,9],new_cd:9,dbshell:9,suppos:[11,8],analyz:11,hello_world:8,extra_context:3,local:8,oct:11,meant:8,contribut:9,variou:[6,2,8],get:[0,3,4,6,8,9,11],familiar:[3,9],django_templ:8,express:8,becaus:[3,11,8],amazon:12,cannot:8,emailfield:11,report:12,requir:[3,11,8,9],mapper:9,article__slug:3,enabl:[3,11,8,9],template_dir:8,artist:9,"public":11,twice:8,cach:[11,2],brush:8,integr:[11,12],though:[2,8],contain:[8,9],httpresponseforbidden:8,steal:11,old_past:8,view:[0,2,3,11,6,8,9],wiki:[3,0,8],set:[3,11,8,9],edit_articl:3,post_save_redirect:8,articleform:3,help_text:3,see:[3,11,2,8,9],date_bas:11,sec:9,result:9,paste_list:8,arg:[3,11],seo:11,labelcommand:8,calendar:9,add_articl:3,best:8,gmail:3,jqueri:3,flexibl:9,learnt:2,extend:[3,11,8],correctli:[3,9],down:[3,8,9],pattern:[3,11,8],someth:[3,11,8],admin_media_prefix:11,label:[3,11,8],written:[11,8],won:11,adminmedia:11,"import":[3,11,8,9],experi:9,email:[3,11,12],attribut:[3,11,9],publishedarticlesmanag:3,signatur:11,accord:[8,9],popup:9,parent:11,list_detail:[3,8],she:11,postgresql_psycopg2:9,add_post:11,wiki_article_detail:3,cycl:7,job:8,djen_project:[3,11,8,9],highlight:9,ipython:9,come:11,valid:[3,11,8,9],"__unicode__":[3,11,8,9],addit:[8,9],both:[3,8],protect:12,revers:[8,9],last:[3,11,8],admin:[3,11,8,9],django_sess:9,howev:[10,8],directori:[3,8,9],equal:9,foreign:11,javascript:11,etc:[3,7,8,9],folder:9,grain:6,context:[3,7,8],logic:8,logout:3,login:[3,11],com:[3,11,8],col:8,title__startswith:9,autofil:[3,11],load:[11,8],rehash:12,simpli:8,point:[3,0,11,8,9],overview:10,unittest:2,each:[11,10,8,9],wonder:8,slugfield:[3,11],walk:2,heirarchi:3,header:9,empti:[11,9],littl:9,commentform:11,exclud:[3,11,9],batteri:7,delete_object:8,backend:[3,11,2,8,9],quit:[3,11],pastebin_past:8,coupl:7,endif:[3,11,8],is_superus:11,been:[3,8],account_activation_dai:3,secret:[3,9],much:8,direct_to_templ:8,interest:[8,9],certain:11,monthli:11,futur:7,popul:[3,9],quickli:9,appcommand:8,registration_form:3,email_host_us:3,pri:9,summari:[3,9],cronjob:8,ani:[3,11,7,8,9],djen_databas:9,understand:9,togeth:[11,12,6,2,8],auth_us:9,child:[3,8],i18n:11,those:[3,8],"case":[8,9],"char":8,auth_user_group:9,noargscommand:8,blog_archive_month:11,packag:[3,11],webpag:8,tables_in_djen_databas:9,mount:8,properti:[3,11,8,9],aim:7,defin:[3,11,6,8,9],"while":[3,8,9],date__lt:9,publicli:8,error:[8,9],email_port:3,anonym:11,fixtur:8,observ:8,endblock:[3,11,8],view_funct:8,larger:12,update_object:8,readi:[7,8,9],modelform:[3,11,8],tabl:[3,0,11,8,9],non:3,worri:9,archiv:11,clutter:9,uncom:[3,11,8,9],conf:[3,11,8],lightweight:7,title__endswith:9,incom:8,revis:3,mani:[3,11,6],ship:[3,11,8,9],"__init__":[8,9],html2pdf:12,httprequest:8,complet:[3,9],is_publish:3,"null":[11,8,9],develop:9,welcom:[0,8],equiv:3,author:[3,11],perform:[11,2,8],make:[3,2,8,9],cross:8,same:[3,11,8],check:[3,9],member:11,handl:[3,11,8],complex:[12,8],edited_on:3,onclick:8,advis:9,autocr:8,document:[3,0,7,8,11],servelet:1,wiki_edit_detail:3,doctest:2,week:11,http:[3,11,6,8,9],webserv:8,rail:7,readonli:8,dai:[3,8],render_to_respons:[3,11,8],fairli:8,moment:3,rais:[8,9],temporari:11,initi:11,pdf:12,auto_now_add:[3,11,8],php:[0,5],respons:[3,7,8],chang:[3,11,8,9],tune:2,recent:[3,8],audit:3,article_list:3,title__contain:9,appropri:11,"_list":8,older:8,entri:[3,0,11,8,9],markup:8,itself:9,except:8,inherit:8,datefield:9,person:[0,9],exampl:[3,11,6,10,8,9],command:8,endfor:[3,11,8],choos:8,programm:[0,5,1],model:[0,2,3,11,10,8,9],pastebin_paste_edit:8,rout:8,left:3,explan:9,comment:[3,11,9],construct:[4,5,1],identifi:11,just:[3,11,8,9],when:[2,3,11,6,8,9],verbose_nam:3,rest:[3,11,9],weekli:11,select:[2,8,9],genre__in:9,aspect:8,mysql:9,touch:8,glue:8,yet:[3,8],languag:[5,8],httprespons:[8,9],bodyclass:11,easi:8,field:[3,11,8,9],interfer:3,pastebin_paste_delet:8,shortcut:[3,11,8],sqlite3:9,delete_old:8,add:[3,11,8,9],is_valid:[3,11],fail_sil:3,tell:8,wiki_article_edit:3,modul:[0,8,9],match:[3,8],take:[11,8,9],applic:[0,2,3,12,8,9],django_content_typ:9,varchar:9,inlud:3,format:[3,12],auto_now:8,queryset:[3,11,8],crud:3,as_p:8,pop:9,loos:7,world:8,bit:9,loader:8,python3:7,desc:9,mainten:8,like:[0,3,10,6,7,8,9,11],success:[3,8],date__gt:9,integ:8,server:[3,9],blog_add_post:11,href:[3,11,8],commit_manu:6,loop:9,output:[3,11,8],architectur:[7,9],manag:[0,3,11,12,8,9],underli:9,as_ul:8,www:8,drop:9,often:9,deal:9,simplifi:11,interact:9,postform:11,back:[4,8],understood:9,intern:[0,10],"export":12,authent:12,as_tabl:[3,11,8],respect:[3,8],proper:8,guarante:8,yesterdai:8,successfulli:3,paste_confirm_delet:8,autocommit:6,kei:[3,11,8,9],txt:3,forcibl:3,djangoproject:[3,11,8],bottom:9,blog_archive_week:11,avoid:8,normal:8,subclass:[3,8,9],track:3,unord:8,larg:12,undon:8,slash:8,genrat:12,foo:[3,11,8],archive_week:11,operationalerror:9,either:[3,11,8],httpresponseredirect:[3,11,8],encourag:9,previou:[2,3,11,12,6,8],run:[3,8,9],autoincr:9,els:[3,11,8,9],archive_month:11,host:9,isn:3,great:[3,8],although:3,post:[3,11,8],"super":[3,11],between:9,wiki_article_histori:3,simpler:8,edit_form:3,paste_form:8,about:[8,9],simplest:11,actual:[11,8],most:[3,11,8],syncdb:[3,8,9],endcom:3,startapp:[8,9],retain:3,page:[0,2,3,11,12,8,9],permission_requir:6,date_field:11,created_on:[3,11,8],constructor:8,fals:[3,11],commit:[3,11],backup:9,processor:7,block:[3,11,8],context_inst:[3,11],own:[8,9],within:9,sketch:[0,8],slug:[3,11],latter:8,pastebin:[3,0,8,11],right:3,activation_email:3,ensur:11,reli:8,soon:11,your:[3,11,8,9],extra_head:3,span:[11,8],log:[3,11,12,2],her:6,support:[3,9],question:6,id_password:11,submit:[3,11,8,9],custom:[3,0,11,8,9],avail:[3,12,9],start:[0,11,8,9],hef:8,interfac:[3,11,9],editor:3,lot:9,suit:8,forward:[3,8],submiss:8,create_upd:8,"function":[3,11,8,9],head:[3,8],doctyp:3,login_url:11,local_set:[3,9],form:[3,11,8,9],offer:3,poster:11,regard:3,link:[3,11,8],startproject:9,line:[3,11,8,9],"true":[3,11,8,9],editform:3,suppli:8,"throw":3,utf:3,input:[3,11,8],tab:9,possibl:9,whether:[3,11,9],type:[3,11,8,9],transactionmiddlewar:6,access:[11,12,8,9],displai:[3,11,8,9],get_query_set:3,record:9,below:[3,11,8],limit:11,capfirst:8,sampl:8,problem:12,booleanfield:3,app_path:11,featur:[11,7],pil:12,creat:[3,11,6,8,9],multipleobjectsreturn:9,"int":9,request:[3,11,6,7,8,9],dure:3,repres:[3,11,9],"_form":8,handle_noarg:8,exist:[3,8,9],file:[11,12,8,9],registration_activ:3,template_load:[3,8],ing:8,radiohead:9,fill:[3,11,8],again:[11,8,9],password:[11,12,9],content_titl:11,know:[3,8,9],titl:[3,11,9],user:[3,4,12,6,8,9,11],diveintopython:8,detail:[3,11,8],activation_email_subject:3,"default":[3,11,8,9],other:[3,4,1,7,8,9,11],lookup:[3,8,9],librari:[0,12,8,9],rememb:8,test:[11,2,8,9],tie:6,you:[3,4,10,8,9],roll:9,nice:3,resolut:9,condens:3,"class":[3,4,10,8,9,11],foreignkei:[3,11],yahoo:[0,6],breadcrumb:11,consid:[3,9],reduc:9,pastebin_paste_cr:8,bitbucket:3,backward:7,home:8,confirm:[8,9],descript:[10,9],hello:[11,8],came:8,time:[11,8,9],plu:3,updated_on:8,profil:[3,2],datetimefield:[3,11,8,9],daili:8},objtypes:{},titles:["Welcome to Djen of django&#8217;s documentation!","Django for the JSP/Sevelet programmer.","Chapter 8. Building a Social news Site","Chapter 5. Building a Wiki","Using Django with Appengine","Django for the PHP programmer","Chapter 6. Building a Yahoo Answer&#8217;s like site","Chapter 1: Introduction","Chapter 3. Building a Pastebin.","Chapter 2. Building a personal CD library.","Hacking Django internals.","Chapter 4. Building a Blog","Chapter 7. Building a Project management application"],objnames:{},filenames:["index","appendix3","chapter8","chapter5","appendix1","appendix2","chapter6","chapter1","chapter3","chapter2","appendix4","chapter4","chapter7"]})
View
18 src/source/chapter5.rst
@@ -182,7 +182,7 @@ To demonstrate custom model managers, we would like to show only 'published' art
Let's write down the models:
.. literalinclude:: djen_project/wiki/models.py
- :commit: f8603b3
+ :commit: 2070d53
Most of the code should be familiar, some things that are new:
@@ -202,14 +202,17 @@ Most of the code should be familiar, some things that are new:
the field name for the label. This can be overridden using ``verbose_name`` argument. ``help_text`` will be displayed below a field in
the rendered ``ModelForm``
+* The ``ordering`` attribute of meta class for ``Edit`` defines the default ordering in which ``edits`` will be returned. This can also be done
+ using ``order_by`` in the queryset.
+
Now, we will need urls similar to our previous app, plus we would need a url to see the article history.
.. literalinclude:: djen_project/wiki/urls.py
- :commit: 41bd9b3
+ :commit: 33f308c
Note that:
-* We will use the object_list generic views for the article index page and detail page.
+* We will use the ``list_detail`` generic views for the article index page and detail page.
* We have to autofill the ``author`` to the logged-in user, so will write a custom view for that.
@@ -240,6 +243,8 @@ In our custom views:
* ``edit_article`` includes two forms, one for the ``Article`` model and the other for the ``Edit`` model. We save both the forms one by one.
+* Passing ``instance`` to the form will populate existing data in the fields.
+
* As planned, the ``author`` field of ``article`` and ``editor``, ``article`` fields of ``Article`` and ``Edit`` respectively, are filled up
before commiting ``save``.
@@ -248,3 +253,10 @@ In our custom views:
* Note the ``filter`` on the ``Edit`` model's queryset and the ``lookup`` on the related ``Article's`` slug.
+To display all the articles on the index page:
+
+``wiki/templates/wiki/article_list.html``:
+
+.. literalinclude:: djen_project/wiki/templates/wiki/article_list.html
+ :language: django
+

0 comments on commit 4f996b9

Please sign in to comment.
Something went wrong with that request. Please try again.