Ticket #5195: tutorial01.diff

File tutorial01.diff, 2.3 KB (added by James Bennett, 17 years ago)

Tutorial adding admonitions about using old Django with SVN tutorial

  • docs/tutorial01.txt

     
    259259        choice = models.CharField(max_length=200)
    260260        votes = models.IntegerField()
    261261
     262.. adminition:: Errors about ``max_length``
     263   
     264   If Django gives you an error message saying that ``max_length`` is
     265   not a valid argument, you're most likely using an old version of
     266   Django (this version of the tutorial is written for the latest
     267   development version of Django). If you do a Subversion checkout of
     268   of Django's development version (see `the installation docs`_ for
     269   more information), you shouldn't have any problems. If you want to
     270   stick with an older version of Django, you'll want to switch to
     271   `the Django 0.96 tutorial`_, since this tutorial covers several
     272   features which only exist in the development version of Django.
     273
     274.. _the installation docs: ../install/
     275.. _the Django 0.96 tutorial: ../0.96/tutorial01/
     276
    262277The code is straightforward. Each model is represented by a class that
    263278subclasses ``django.db.models.Model``. Each model has a number of class
    264279variables, each of which represents a database field in the model.
     
    487502        def __unicode__(self):
    488503            return self.choice
    489504
     505.. admonition:: If ``__unicode__()`` doesn't seem to work
     506   
     507   If you add the ``__unicode__()`` method to your models and don't
     508   see any change in how they're represented, you're most likely using
     509   an old version of Django (this version of the tutorial is written
     510   for the latest development version of Django). If you do a
     511   Subversion checkout of of Django's development version (see `the
     512   installation docs`_ for more information), you shouldn't have any
     513   problems. If you want to stick with an older version of Django,
     514   you'll want to switch to `the Django 0.96 tutorial`_, since this
     515   tutorial covers several features which only exist in the
     516   development version of Django.
     517
     518.. _the installation docs: ../install/
     519.. _the Django 0.96 tutorial: ../0.96/tutorial01/
     520
    490521It's important to add ``__unicode__()`` methods to your models, not only for
    491522your own sanity when dealing with the interactive prompt, but also because
    492523objects' representations are used throughout Django's automatically-generated
Back to Top