Ticket #2592: 2592.diff
File 2592.diff, 2.3 KB (added by , 18 years ago) |
---|
-
tutorial01.txt
30 30 31 31 From the command line, ``cd`` into a directory where you'd like to store your 32 32 code, then run the command ``django-admin.py startproject mysite``. This 33 will create a ``mysite`` directory in your current directory. 33 will create a ``mysite`` directory in your current directory. (Quick note: there 34 are a few names you can't use as this will interfere with core parts of Django, 35 ``site`` is one of these). 34 36 35 37 (``django-admin.py`` should be on your system path if you installed Django via 36 38 ``python setup.py``. If it's not on your path, you can find it in … … 81 83 Validating models... 82 84 0 errors found. 83 85 84 Django version 0.9 5, using settings 'mysite.settings'86 Django version 0.96-pre, using settings 'mysite.settings' 85 87 Development server is running at http://127.0.0.1:8000/ 86 88 Quit the server with CONTROL-C (Unix) or CTRL-BREAK (Windows). 87 89 … … 482 484 Note the addition of ``import datetime`` to reference Python's standard 483 485 ``datetime`` module. 484 486 485 Let's jump back intothe Python interactive shell by running487 To activate these changes, restart the Python interactive shell by running 486 488 ``python manage.py shell`` again:: 487 489 488 490 >>> from mysite.polls.models import Poll, Choice … … 495 497 # keyword arguments. 496 498 >>> Poll.objects.filter(id=1) 497 499 [<Poll: What's up?>] 500 # Note: that's TWO underscores after the fieldname "question" 498 501 >>> Poll.objects.filter(question__startswith='What') 499 502 [<Poll: What's up?>] 500 503 … … 519 522 >>> p.was_published_today() 520 523 False 521 524 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 524 530 # of available choices and returns the new Choice object. 525 531 >>> p = Poll.objects.get(pk=1) 526 532 >>> p.choice_set.create(choice='Not much', votes=0)