Django

Code

Changeset 8325

Show
Ignore:
Timestamp:
08/12/08 09:15:38 (4 months ago)
Author:
gwilson
Message:

Fixed a couple typos in the modeltests' descriptions and made use of ReST inline literal markup for code snippets.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/tests/modeltests/custom_columns/models.py

    r7477 r8325  
    1212If you need to use a table name for a many-to-many relationship that differs 
    1313from the default generated name, use the ``db_table`` parameter on the 
    14 ManyToMany field. This has no effect on the API for querying the database. 
     14``ManyToMany`` field. This has no effect on the API for querying the database. 
    1515 
    1616""" 
     
    8888AttributeError: 'Author' object has no attribute 'last' 
    8989 
    90 # Although the Article table uses a custom m2m table,  
     90# Although the Article table uses a custom m2m table, 
    9191# nothing about using the m2m relationship has changed... 
    9292 
  • django/trunk/tests/modeltests/files/models.py

    r8244 r8325  
    2242. Storing files according to a custom storage system 
    33 
    4 FileField and its variations can take a "storage" argument to specify how and 
    5 where files should be stored. 
     4``FileField`` and its variations can take a ``storage`` argument to specify how 
     5and where files should be stored. 
    66""" 
    77 
  • django/trunk/tests/modeltests/fixtures/models.py

    r7949 r8325  
    66are identified by name, and are stored in either a directory named 'fixtures' 
    77in the application directory, on in one of the directories named in the 
    8 FIXTURE_DIRS setting. 
     8``FIXTURE_DIRS`` setting. 
    99""" 
    1010 
  • django/trunk/tests/modeltests/generic_relations/models.py

    r8279 r8325  
    33 
    44Generic relations let an object have a foreign key to any object through a 
    5 content-type/object-id field. A generic foreign key can point to any object, 
    6 be it animal, vegetable, or mineral. 
     5content-type/object-id field. A ``GenericForeignKey`` field can point to any 
     6object, be it animal, vegetable, or mineral. 
    77 
    88The canonical example is tags (although this example implementation is *far* 
     
    3333    """ 
    3434    comparative = models.CharField(max_length=50) 
    35      
     35 
    3636    content_type1 = models.ForeignKey(ContentType, related_name="comparative1_set") 
    3737    object_id1 = models.PositiveIntegerField() 
     
    5151 
    5252    tags = generic.GenericRelation(TaggedItem) 
    53     comparisons = generic.GenericRelation(Comparison,  
     53    comparisons = generic.GenericRelation(Comparison, 
    5454                                          object_id_field="object_id1", 
    5555                                          content_type_field="content_type1") 
  • django/trunk/tests/modeltests/get_latest/models.py

    r5876 r8325  
    33 
    44Models can have a ``get_latest_by`` attribute, which should be set to the name 
    5 of a DateField or DateTimeField. If ``get_latest_by`` exists, the model's 
    6 manager will get a ``latest()`` method, which will return the latest object in 
    7 the database according to that field. "Latest" means "having the date farthest 
    8 into the future." 
     5of a ``DateField`` or ``DateTimeField``. If ``get_latest_by`` exists, the 
     6model's manager will get a ``latest()`` method, which will return the latest 
     7object in the database according to that field. "Latest" means "having the date 
     8farthest into the future." 
    99""" 
    1010 
  • django/trunk/tests/modeltests/get_object_or_404/models.py

    r6838 r8325  
    2235. DB-API Shortcuts 
    33 
    4 get_object_or_404 is a shortcut function to be used in view functions for 
    5 performing a get() lookup and raising a Http404 exception if a DoesNotExist 
    6 exception was raised during the get() call. 
     4``get_object_or_404()`` is a shortcut function to be used in view functions for 
     5performing a ``get()`` lookup and raising a ``Http404`` exception if a 
     6``DoesNotExist`` exception was raised during the ``get()`` call. 
    77 
    8 get_list_or_404 is a shortcut function to be used in view functions for 
    9 performing a filter() lookup and raising a Http404 exception if a DoesNotExist 
    10 exception was raised during the filter() call. 
     8``get_list_or_404()`` is a shortcut function to be used in view functions for 
     9performing a ``filter()`` lookup and raising a ``Http404`` exception if a 
     10``DoesNotExist`` exception was raised during the ``filter()`` call. 
    1111""" 
    1212 
     
    1717class Author(models.Model): 
    1818    name = models.CharField(max_length=50) 
    19      
     19 
    2020    def __unicode__(self): 
    2121        return self.name 
     
    3030    objects = models.Manager() 
    3131    by_a_sir = ArticleManager() 
    32      
     32 
    3333    def __unicode__(self): 
    3434        return self.title 
  • django/trunk/tests/modeltests/get_or_create/models.py

    r5876 r8325  
    2233. get_or_create() 
    33 
    4 get_or_create() does what it says: it tries to look up an object with the given 
    5 parameters. If an object isn't found, it creates one with the given parameters. 
     4``get_or_create()`` does what it says: it tries to look up an object with the 
     5given parameters. If an object isn't found, it creates one with the given 
     6parameters. 
    67""" 
    78 
  • django/trunk/tests/modeltests/m2m_intermediary/models.py

    r5876 r8325  
    55table, use an intermediary model. 
    66 
    7 In this example, an ``Article`` can have multiple ``Reporter``s, and each 
    8 ``Article``-``Reporter`` combination (a ``Writer``) has a ``position`` field, 
    9 which specifies the ``Reporter``'s position for the given article (e.g. "Staff 
    10 writer"). 
     7In this example, an ``Article`` can have multiple ``Reporter`` objects, and 
     8each ``Article``-``Reporter`` combination (a ``Writer``) has a ``position`` 
     9field, which specifies the ``Reporter``'s position for the given article 
     10(e.g. "Staff writer"). 
    1111""" 
    1212 
  • django/trunk/tests/modeltests/m2m_multiple/models.py

    r5876 r8325  
    2220. Multiple many-to-many relationships between the same two tables 
    33 
    4 In this example, an Article can have many Categories (as "primary") and many 
    5 Categories (as "secondary")
     4In this example, an ``Article`` can have many "primary" ``Category`` objects 
     5and many "secondary" ``Category`` objects
    66 
    77Set ``related_name`` to designate what the reverse relationship is called. 
  • django/trunk/tests/modeltests/m2m_recursive/models.py

    r5876 r8325  
    2228. Many-to-many relationships between the same two tables 
    33 
    4 In this example, A Person can have many friends, who are also people. Friendship is a 
    5 symmetrical relationship - if I am your friend, you are my friend. 
     4In this example, a ``Person`` can have many friends, who are also ``Person`` 
     5objects. Friendship is a symmetrical relationship - if I am your friend, you 
     6are my friend. Here, ``friends`` is an example of a symmetrical 
     7``ManyToManyField``. 
    68 
    7 A person can also have many idols - but while I may idolize you, you may not think 
    8 the same of me. 'Idols' is an example of a non-symmetrical m2m field. Only recursive 
    9 m2m fields may be non-symmetrical, and they are symmetrical by default. 
     9A ``Person`` can also have many idols - but while I may idolize you, you may 
     10not think the same of me. Here, ``idols`` is an example of a non-symmetrical 
     11``ManyToManyField``. Only recursive ``ManyToManyField`` fields may be 
     12non-symmetrical, and they are symmetrical by default. 
    1013 
    11 This test validates that the m2m table will create a mangled name for the m2m table if 
    12 there will be a clash, and tests that symmetry is preserved where appropriate. 
     14This test validates that the many-to-many table is created using a mangled name 
     15if there is a name clash, and tests that symmetry is preserved where 
     16appropriate. 
    1317""" 
    1418 
  • django/trunk/tests/modeltests/manipulators/models.py

    r7322 r8325  
    3327. Default manipulators 
    44 
    5 Each model gets an AddManipulator and ChangeManipulator by default. 
     5Each model gets an ``AddManipulator`` and ``ChangeManipulator`` by default. 
    66""" 
    77 
  • django/trunk/tests/modeltests/many_to_many/models.py

    r7622 r8325  
    225. Many-to-many relationships 
    33 
    4 To define a many-to-many relationship, use ManyToManyField()
    5  
    6 In this example, an article can be published in multiple publications, 
    7 and a publication has multiple articles. 
     4To define a many-to-many relationship, use ``ManyToManyField()``
     5 
     6In this example, an ``Article`` can be published in multiple ``Publication`` 
     7objects, and a ``Publication`` has multiple ``Article`` objects. 
    88""" 
    99 
  • django/trunk/tests/modeltests/many_to_one/models.py

    r8185 r8325  
    224. Many-to-one relationships 
    33 
    4 To define a many-to-one relationship, use ``ForeignKey()``
     4To define a many-to-one relationship, use ``ForeignKey()``
    55""" 
    66 
  • django/trunk/tests/modeltests/model_forms/models.py

    r8291 r8325  
    22XX. Generating HTML forms from models 
    33 
    4 This is mostly just a reworking of the form_for_model/form_for_instance tests 
    5 to use ModelForm. As such, the text may not make sense in all cases, and the 
    6 examples are probably a poor fit for the ModelForm syntax. In other words, 
    7 most of these tests should be rewritten. 
     4This is mostly just a reworking of the ``form_for_model``/``form_for_instance`` 
     5tests to use ``ModelForm``. As such, the text may not make sense in all cases, 
     6and the examples are probably a poor fit for the ``ModelForm`` syntax. In other 
     7words, most of these tests should be rewritten. 
    88""" 
    99 
  • django/trunk/tests/modeltests/ordering/models.py

    r7477 r8325  
    44Specify default ordering for a model using the ``ordering`` attribute, which 
    55should be a list or tuple of field names. This tells Django how to order 
    6 queryset results. 
     6``QuerySet`` results. 
    77 
    88If a field name in ``ordering`` starts with a hyphen, that field will be 
  • django/trunk/tests/modeltests/or_lookups/models.py

    r7914 r8325  
    2219. OR lookups 
    33 
    4 To perform an OR lookup, or a lookup that combines ANDs and ORs, 
    5 combine QuerySet objects using & and | operators. 
     4To perform an OR lookup, or a lookup that combines ANDs and ORs, combine 
     5``QuerySet`` objects using ``&`` and ``|`` operators. 
    66 
    77Alternatively, use positional arguments, and pass one or more expressions of 
    88clauses using the variable ``django.db.models.Q`` (or any object with an 
    9 add_to_query method). 
     9``add_to_query`` method). 
    1010""" 
    1111# Python 2.3 doesn't have sorted() 
  • django/trunk/tests/modeltests/serializers/models.py

    r7477 r8325  
    3342. Serialization 
    44 
    5 ``django.core.serializers`` provides interfaces to converting Django querysets 
    6 to and from "flat" data (i.e. strings). 
     5``django.core.serializers`` provides interfaces to converting Django 
     6``QuerySet`` objects to and from "flat" data (i.e. strings). 
    77""" 
    88 
  • django/trunk/tests/modeltests/test_client/models.py

    r7900 r8325  
    1212process of serving the request. 
    1313 
    14 Client objects are stateful - they will retain cookie (and 
    15 thus session) details for the lifetime of the Client instance. 
    16  
    17 This is not intended as a replacement for Twill,Selenium, or 
     14``Client`` objects are stateful - they will retain cookie (and 
     15thus session) details for the lifetime of the ``Client`` instance. 
     16 
     17This is not intended as a replacement for Twill, Selenium, or 
    1818other browser automation frameworks - it is here to allow 
    1919testing against the contexts and templates produced by a view, 
  • django/trunk/tests/modeltests/user_commands/models.py

    r7294 r8325  
    2238. User-registered management commands 
    33 
    4 The manage.py utility provides a number of useful commands for managing a 
     4The ``manage.py`` utility provides a number of useful commands for managing a 
    55Django project. If you want to add a utility command of your own, you can. 
    66 
    7 The user-defined command 'dance' is defined in the management/commands  
    8 subdirectory of this test application. It is a simple command that responds  
     7The user-defined command ``dance`` is defined in the management/commands 
     8subdirectory of this test application. It is a simple command that responds 
    99with a printed message when invoked. 
    1010 
    11 For more details on how to define your own manage.py commands, look at the 
    12 django.core.management.commands directory. This directory contains the 
    13 definitions for the base Django manage.py commands. 
     11For more details on how to define your own ``manage.py`` commands, look at the 
     12``django.core.management.commands`` directory. This directory contains the 
     13definitions for the base Django ``manage.py`` commands. 
    1414""" 
    1515