Django

Code

Changeset 5825

Show
Ignore:
Timestamp:
08/06/07 21:33:11 (1 year ago)
Author:
adrian
Message:

Fixed #5097 -- Made various updates and corrections to the documentation. Thanks, Nicola Larosa

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/docs/contributing.txt

    r5803 r5825  
    546546 
    547547Yes, the unit tests need a settings module, but only for database connection 
    548 info -- the ``DATABASE_NAME`` (required, but will be ignored), 
    549 ``DATABASE_ENGINE``, ``DATABASE_USER`` and ``DATABASE_PASSWORD`` settings. You 
    550 will also need a ``ROOT_URLCONF`` setting (its value is ignored; it just needs 
    551 to be present) and a ``SITE_ID`` setting (any non-zero integer value will do) 
    552 in order for all the tests to pass. 
     548info, with the ``DATABASE_ENGINE`` setting. You will also need a ``ROOT_URLCONF`` 
     549setting (its value is ignored; it just needs to be present) and a ``SITE_ID`` 
     550setting (any non-zero integer value will do) in order for all the tests to pass. 
    553551 
    554552The unit tests will not touch your existing databases; they create a new 
  • django/trunk/docs/i18n.txt

    r5609 r5825  
    264264``ugettext`` / ``ungettext`` call. 
    265265 
    266 Each ``RequestContext`` has access to two translation-specific variables: 
     266Each ``RequestContext`` has access to three translation-specific variables: 
    267267 
    268268    * ``LANGUAGES`` is a list of tuples in which the first element is the 
  • django/trunk/docs/model-api.txt

    r5816 r5825  
    151151the old ``maxlength`` argument, but ``max_length`` is prefered. 
    152152         
    153  ``CommaSeparatedIntegerField`` 
     153``CommaSeparatedIntegerField`` 
    154154~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    155155 
     
    738738any other ``Field`` type: by including it as a class attribute of your model. 
    739739 
    740 ``ForeignKey`` requires a positional argument: The class to which the model is 
     740``ForeignKey`` requires a positional argument: the class to which the model is 
    741741related. 
    742742 
     
    873873model. 
    874874 
    875 ``ManyToManyField`` requires a positional argument: The class to which the 
     875``ManyToManyField`` requires a positional argument: the class to which the 
    876876model is related. 
    877877 
     
    970970another object in some way. 
    971971 
    972 ``OneToOneField`` requires a positional argument: The class to which the 
     972``OneToOneField`` requires a positional argument: the class to which the 
    973973model is related. 
    974974 
     
    14221422A few special cases to note about ``list_display``: 
    14231423 
    1424     * If the field is a ``ForeignKey``, Django will display the ``__str__()`` 
    1425       of the related object. 
     1424    * If the field is a ``ForeignKey``, Django will display the 
     1425      ``__unicode__()`` of the related object. 
    14261426 
    14271427    * ``ManyToManyField`` fields aren't supported, because that would entail 
     
    16731673 
    16741674    Note that the query input is split by spaces, so, following this example, 
    1675     it's not currently not possible to search for all records in which 
     1675    it's currently not possible to search for all records in which 
    16761676    ``first_name`` is exactly ``'john winston'`` (containing a space). 
    16771677 
     
    19571957method. 
    19581958 
    1959 .. syndication feed framework: ../syndication_feeds/ 
     1959.. _syndication feed framework: ../syndication_feeds/ 
    19601960 
    19611961It's good practice to use ``get_absolute_url()`` in templates, instead of 
     
    20162016    get_absolute_url = permalink(get_absolute_url) 
    20172017 
    2018 Notice that we specify an empty sequence for the second argument in this case, 
    2019 because we only want to pass keyword arguments, not named arguments. 
     2018Notice that we specify an empty sequence for the second parameter in this case, 
     2019because we only want to pass keyword parameters, not positional ones. 
    20202020 
    20212021In this way, you're tying the model's absolute URL to the view that is used 
  • django/trunk/docs/overview.txt

    r5803 r5825  
    5555 
    5656With that, you've got a free, and rich, Python API to access your data. The API 
    57 is created on the fly: No code generation necessary:: 
     57is created on the fly, no code generation necessary:: 
    5858 
    5959    >>> from mysite.models import Reporter, Article 
     
    125125    >>> r.delete() 
    126126 
    127 A dynamic admin interface: It's not just scaffolding -- it's the whole house 
     127A dynamic admin interface: it's not just scaffolding -- it's the whole house 
    128128============================================================================ 
    129129 
     
    251251'base', which has defined a bunch of blocks, and fill the blocks with the 
    252252following blocks." In short, that lets you dramatically cut down on redundancy 
    253 in templates: Each template has to define only what's unique to that template. 
     253in templates: each template has to define only what's unique to that template. 
    254254 
    255255Here's what the "base.html" template might look like:: 
  • django/trunk/docs/tutorial01.txt

    r5803 r5825  
    462462    "What's up?" 
    463463    >>> p.pub_date 
    464     datetime.datetime(2005, 7, 15, 12, 00, 53) 
     464    datetime.datetime(2007, 7, 15, 12, 00, 53) 
    465465 
    466466    # Change values by changing the attributes, then calling save(). 
    467     >>> p.pub_date = datetime(2005, 4, 1, 0, 0) 
     467    >>> p.pub_date = datetime(2007, 4, 1, 0, 0) 
    468468    >>> p.save() 
    469469 
     
    538538    [<Poll: What's up?>] 
    539539 
    540     # Get the poll whose year is 2005. Of course, if you're going through this 
     540    # Get the poll whose year is 2007. Of course, if you're going through this 
    541541    # tutorial in another year, change as appropriate. 
    542     >>> Poll.objects.get(pub_date__year=2005
     542    >>> Poll.objects.get(pub_date__year=2007
    543543    <Poll: What's up?> 
    544544 
     
    581581    # The API automatically follows relationships as far as you need. 
    582582    # Use double underscores to separate relationships. 
    583     # This works as many levels deep as you want. There's no limit. 
    584     # Find all Choices for any poll whose pub_date is in 2005
    585     >>> Choice.objects.filter(poll__pub_date__year=2005
     583    # This works as many levels deep as you want; there's no limit. 
     584    # Find all Choices for any poll whose pub_date is in 2007
     585    >>> Choice.objects.filter(poll__pub_date__year=2007
    586586    [<Choice: Not much>, <Choice: The sky>, <Choice: Just hacking again>] 
    587587 
  • django/trunk/docs/tutorial02.txt

    r5803 r5825  
    363363================================= 
    364364 
    365 Clearly, having "Django administration" and "example.com" at the top of each 
    366 admin page is ridiculous. It's just placeholder text. 
     365Clearly, having "Django administration" at the top of each admin page is 
     366ridiculous. It's just placeholder text. 
    367367 
    368368That's easy to change, though, using Django's template system. The Django admin 
     
    390390 
    391391Then, just edit the file and replace the generic Django text with your own 
    392 site's name and URL as you see fit. 
     392site's name as you see fit. 
    393393 
    394394Note that any of Django's default admin templates can be overridden. To