Make a website with Django: Difference between revisions

imported>Jesstess
No edit summary
imported>Jesstess
Line 28:
 
The official Django tutorial walks you through creating an interactive polling application in 4 parts.
 
 
=== 1. Complete Part 1 of the tutorial ===
Line 36 ⟶ 35:
In this part, you'll create a new project, learn how to run your development server, set up a database, and create some models for your polling app. Some of the setup that you are doing in this section will make more sense once you start actually using the code a bit later in the tutorial -- don't worry if the purpose of some of the steps you are going through is a bit unclear at first.
 
<br />
After you've completed part 1:<br />
<br />
<b>Check your understanding</b>: What is the relationship between the classes in <code>models.py</code> and the database schema displayed when you run <code>python manage.py sql polls</code>.
 
Line 46 ⟶ 47:
* Please visit https://docs.djangoproject.com/en/1.4/intro/tutorial02/ and complete part 2 of the tutorial.
 
<br />
After you've completed part 2:<br />
<br />
<b>Check your understanding</b>: What did you have to do to get your poll app displayed on the admin index page?
 
Line 53 ⟶ 57:
* Please visit https://docs.djangoproject.com/en/1.4/intro/tutorial03/ and complete part 3 of the tutorial.
 
<br />
<b>Check your understanding</b>: Which of the following URL fragments matches this pattern from a sample <code>urls.py</code>?
After you've completed part 3:<br />
<br />
 
<b>Check your understanding</b>: Why are templates a good idea?
 
<ol>
<li>
<b>Check your understanding</b>: Which of the following URL fragments matches this pattern from a sample <code>urls.py</code>?
<pre>r'^polls/(?P<poll_id>\d+)/results/$'</pre>
 
Line 59 ⟶ 71:
* polls/12345/results/
* polls//results/
</li>
 
<li>
<b>Check your understanding</b>: Why are templates a good idea?
Why are templates a good idea?
 
</li>
<b>Check your understanding</b>: What is the purpose of <code>t.render</code> in this code snippet?
<li>
<b>Check your understanding</b>: What is the purpose of <code>t.render</code> in this code snippet?
 
<pre>def index(request):
Line 71 ⟶ 85:
})
return HttpResponse(t.render(c))</pre>
</li>
</ol>
 
 
Line 76 ⟶ 92:
 
* Please visit https://docs.djangoproject.com/en/1.4/intro/tutorial04/ and complete part 4 of the tutorial.
 
<br />
After you've completed part 4:<br />
<br />
 
<b>Check your understanding</b>: What is in <code>request.POST</code>?
Anonymous user