summaryrefslogtreecommitdiff
path: root/docs/intro/tutorial01.txt
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2013-02-07 05:51:25 -0500
committerTim Graham <timograham@gmail.com>2013-02-07 07:05:36 -0500
commitaa85ccf8ce11c4b8374c74fd9dfe72647be49ada (patch)
tree4e68ef43ea9f82b93b23acf5267e35c18c2c6fce /docs/intro/tutorial01.txt
parent43efefae692729925c0f75c55e93bd1f33f42bfd (diff)
Fixed #19706 - Tweaks to the tutorial.
Thanks Daniele Procida.
Diffstat (limited to 'docs/intro/tutorial01.txt')
-rw-r--r--docs/intro/tutorial01.txt10
1 files changed, 7 insertions, 3 deletions
diff --git a/docs/intro/tutorial01.txt b/docs/intro/tutorial01.txt
index 56a068ff1f..9b0c820380 100644
--- a/docs/intro/tutorial01.txt
+++ b/docs/intro/tutorial01.txt
@@ -146,7 +146,7 @@ purely in Python. We've included this with Django so you can develop things
rapidly, without having to deal with configuring a production server -- such as
Apache -- until you're ready for production.
-Now's a good time to note: DON'T use this server in anything resembling a
+Now's a good time to note: **Don't** use this server in anything resembling a
production environment. It's intended only for use while developing. (We're in
the business of making Web frameworks, not Web servers.)
@@ -354,7 +354,7 @@ These concepts are represented by simple Python classes. Edit the
class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice_text = models.CharField(max_length=200)
- votes = models.IntegerField()
+ votes = models.IntegerField(default=0)
The code is straightforward. Each model is represented by a class that
subclasses :class:`django.db.models.Model`. Each model has a number of class
@@ -377,11 +377,15 @@ example, we've only defined a human-readable name for ``Poll.pub_date``. For all
other fields in this model, the field's machine-readable name will suffice as
its human-readable name.
-Some :class:`~django.db.models.Field` classes have required elements.
+Some :class:`~django.db.models.Field` classes have required arguments.
:class:`~django.db.models.CharField`, for example, requires that you give it a
:attr:`~django.db.models.CharField.max_length`. That's used not only in the
database schema, but in validation, as we'll soon see.
+A :class:`~django.db.models.Field` can also have various optional arguments; in
+this case, we've set the :attr:`~django.db.models.Field.default` value of
+``votes`` to 0.
+
Finally, note a relationship is defined, using
:class:`~django.db.models.ForeignKey`. That tells Django each ``Choice`` is related
to a single ``Poll``. Django supports all the common database relationships: