diff --git a/docs/tutorial01.txt b/docs/tutorial01.txt index aea3af6922..180e30292d 100644 --- a/docs/tutorial01.txt +++ b/docs/tutorial01.txt @@ -22,10 +22,10 @@ installed. .. admonition:: Where to get help: If you're having trouble going through this tutorial, please post a message - to `django-users`_ or drop by `#django`_ on ``irc.freenode.net`` and we'll + to `django-users`_ or drop by `#django`_ on ``irc.freenode.net`` and we'll try to help. -.. _django-users: http://groups.google.com/group/django-users +.. _django-users: http://groups.google.com/group/django-users .. _#django: irc://irc.freenode.net/django Creating a project @@ -42,7 +42,7 @@ code, then run the command ``django-admin.py startproject mysite``. This will create a ``mysite`` directory in your current directory. .. note:: - + You'll need to avoid naming projects after built-in Python or Django components. In particular, this means you should avoid using names like ``django`` (which will conflict with Django itself) or ``site`` (which @@ -321,7 +321,7 @@ Now Django knows ``mysite`` includes the ``polls`` app. Let's run another comman python manage.py sql polls -You should see something similar to the following (the CREATE TABLE SQL statements +You should see something similar to the following (the CREATE TABLE SQL statements for the polls app):: BEGIN; @@ -341,7 +341,7 @@ for the polls app):: Note the following: * The exact output will vary depending on the database you are using. - + * Table names are automatically generated by combining the name of the app (``polls``) and the lowercase name of the model -- ``poll`` and ``choice``. (You can override this behavior.) @@ -371,8 +371,8 @@ If you're interested, also run the following commands: construction of your models. * ``python manage.py sqlcustom polls`` -- Outputs any custom SQL statements - (such as table modifications or constraints) that are defined for the - application. + (such as table modifications or constraints) that are defined for the + application. * ``python manage.py sqlclear polls`` -- Outputs the necessary ``DROP TABLE`` statements for this app, according to which tables already exist @@ -494,19 +494,19 @@ admin. .. admonition:: Why ``__unicode__()`` and not ``__str__()``? - If you're familiar with Python, you might be in the habit of adding - ``__str__()`` methods to your classes, not ``__unicode__()`` methods. + If you're familiar with Python, you might be in the habit of adding + ``__str__()`` methods to your classes, not ``__unicode__()`` methods. We use ``__unicode__()`` here because Django models deal with Unicode by default. All data stored in your database is converted to Unicode when it's returned. - Django models have a default ``__str__()`` method that calls ``__unicode__()`` - and converts the result to a UTF-8 bytestring. This means that ``unicode(p)`` - will return a Unicode string, and ``str(p)`` will return a normal string, - with characters encoded as UTF-8. + Django models have a default ``__str__()`` method that calls + ``__unicode__()`` and converts the result to a UTF-8 bytestring. This means + that ``unicode(p)`` will return a Unicode string, and ``str(p)`` will return + a normal string, with characters encoded as UTF-8. - If all of this is jibberish to you, just remember to add ``__unicode__()`` - methods to your models. With any luck, things should Just Work for you. + If all of this is jibberish to you, just remember to add ``__unicode__()`` + methods to your models. With any luck, things should Just Work for you. Note these are normal Python methods. Let's add a custom method, just for demonstration::