Ticket #2592: 2592.diff

File 2592.diff, 2.3 KB (added by Simon G. <dev@…>, 8 years ago)
  • tutorial01.txt

     
    3030
    3131From the command line, ``cd`` into a directory where you'd like to store your
    3232code, then run the command ``django-admin.py startproject mysite``. This
    33 will create a ``mysite`` directory in your current directory.
     33will create a ``mysite`` directory in your current directory. (Quick note: there
     34are a few names you can't use as this will interfere with core parts of Django,
     35``site`` is one of these).
    3436
    3537(``django-admin.py`` should be on your system path if you installed Django via
    3638``python setup.py``. If it's not on your path, you can find it in
     
    8183    Validating models...
    8284    0 errors found.
    8385
    84     Django version 0.95, using settings 'mysite.settings'
     86    Django version 0.96-pre, using settings 'mysite.settings'
    8587    Development server is running at http://127.0.0.1:8000/
    8688    Quit the server with CONTROL-C (Unix) or CTRL-BREAK (Windows).
    8789
     
    482484Note the addition of ``import datetime`` to reference Python's standard
    483485``datetime`` module.
    484486
    485 Let's jump back into the Python interactive shell by running
     487To activate these changes, restart the Python interactive shell by running
    486488``python manage.py shell`` again::
    487489
    488490    >>> from mysite.polls.models import Poll, Choice
     
    495497    # keyword arguments.
    496498    >>> Poll.objects.filter(id=1)
    497499    [<Poll: What's up?>]
     500    # Note: that's TWO underscores after the fieldname "question"
    498501    >>> Poll.objects.filter(question__startswith='What')
    499502    [<Poll: What's up?>]
    500503
     
    519522    >>> p.was_published_today()
    520523    False
    521524
    522     # Give the Poll a couple of Choices. The create call constructs a new
    523     # choice object, does the INSERT statement, adds the choice to the set
     525    # Give the Poll a couple of Choices.
     526    # Because the Poll is related to a set of Choices, the Poll object will have
     527    # a choice_set object which stores these. It's currently empty, so let's give
     528    # the Poll a few Choices by using the create call.
     529    # This does the INSERT statement, adds the choice to the set
    524530    # of available choices and returns the new Choice object.
    525531    >>> p = Poll.objects.get(pk=1)
    526532    >>> p.choice_set.create(choice='Not much', votes=0)
Back to Top