Ticket #5480: 5480.patch

File 5480.patch, 15.6 KB (added by John DeRosa, 17 years ago)

Renumbered the docstrings within each model file

  • tests/modeltests/choices/models.py

     
    11"""
    2 21. Specifying 'choices' for a field
     218. Specifying 'choices' for a field
    33
    44Most fields take a ``choices`` parameter, which should be a tuple of tuples
    55specifying which are the valid values for that field.
  • tests/modeltests/custom_columns/models.py

     
    11"""
    2 17. Custom column/table names
     214. Custom column/table names
    33
    44If your database column name is different than your model attribute, use the
    55``db_column`` parameter. Note that you'll use the field's name, not its column
  • tests/modeltests/custom_managers/models.py

     
    11"""
    2 23. Giving models a custom manager
     220. Giving models a custom manager
    33
    44You can use a custom ``Manager`` in a particular model by extending the base
    55``Manager`` class and instantiating your custom ``Manager`` in your model.
  • tests/modeltests/custom_methods/models.py

     
    11"""
    2 3. Giving models custom methods
     21. Giving models custom methods
    33
    44Any method you add to a model will be available to instances.
    55"""
  • tests/modeltests/empty/models.py

     
    11"""
    2 40. Empty model tests
     235. Empty model tests
    33
    44These test that things behave sensibly for the rare corner-case of a model with
    55no fields.
  • tests/modeltests/field_defaults/models.py

     
    11"""
    2 32. Callable defaults
     229. Callable defaults
    33
    44You can pass callable objects as the ``default`` parameter to a field. When
    55the object is created without an explicit value passed in, Django will call
  • tests/modeltests/fixtures/models.py

     
    11"""
    2 37. Fixtures.
     233. Fixtures.
    33
    44Fixtures are a way of loading data into the database in bulk. Fixure data
    55can be stored in any serializable format (including JSON and XML). Fixtures
  • tests/modeltests/generic_relations/models.py

     
    11"""
    2 34. Generic relations
     231. Generic relations
    33
    44Generic relations let an object have a foreign key to any object through a
    55content-type/object-id field. A generic foreign key can point to any object,
  • tests/modeltests/get_latest/models.py

     
    11"""
    2 8. get_latest_by
     26. get_latest_by
    33
    44Models can have a ``get_latest_by`` attribute, which should be set to the name
    55of a DateField or DateTimeField. If ``get_latest_by`` exists, the model's
  • tests/modeltests/get_object_or_404/models.py

     
    11"""
    2 35. DB-API Shortcuts
     232. DB-API Shortcuts
    33
    44get_object_or_404 is a shortcut function to be used in view functions for
    55performing a get() lookup and raising a Http404 exception if a DoesNotExist
  • tests/modeltests/get_or_create/models.py

     
    11"""
    2 33. get_or_create()
     230. get_or_create()
    33
    44get_or_create() does what it says: it tries to look up an object with the given
    55parameters. If an object isn't found, it creates one with the given parameters.
  • tests/modeltests/invalid_models/models.py

     
    11"""
    2 26. Invalid models
     223. Invalid models
    33
    44This example exists purely to point out errors in models.
    55"""
  • tests/modeltests/lookup/models.py

     
    11"""
    2 7. The lookup API
     25. The lookup API
    33
    44This demonstrates features of the database API.
    55"""
  • tests/modeltests/m2m_and_m2o/models.py

     
    11"""
    2 29. Many-to-many and many-to-one relationships to the same table
     226. Many-to-many and many-to-one relationships to the same table
    33
    44Make sure to set ``related_name`` if you use relationships to the same table.
    55"""
  • tests/modeltests/m2m_intermediary/models.py

     
    11"""
    2 9. Many-to-many relationships via an intermediary table
     27. Many-to-many relationships via an intermediary table
    33
    44For many-to-many relationships that need extra fields on the intermediary
    55table, use an intermediary model.
  • tests/modeltests/m2m_multiple/models.py

     
    11"""
    2 20. Multiple many-to-many relationships between the same two tables
     217. Multiple many-to-many relationships between the same two tables
    33
    44In this example, an Article can have many Categories (as "primary") and many
    55Categories (as "secondary").
  • tests/modeltests/m2m_recursive/models.py

     
    11"""
    2 28. Many-to-many relationships between the same two tables
     225. Many-to-many relationships between the same two tables
    33
    44In this example, A Person can have many friends, who are also people. Friendship is a
    55symmetrical relationship - if I am your friend, you are my friend.
  • tests/modeltests/m2o_recursive2/models.py

     
    11"""
    2 12. Relating a model to another model more than once
     210. Relating a model to another model more than once
    33
    44In this example, a ``Person`` can have a ``mother`` and ``father`` -- both of
    55which are other ``Person`` objects.
  • tests/modeltests/m2o_recursive/models.py

     
    11"""
    2 11. Relating an object to itself, many-to-one
     29. Relating an object to itself, many-to-one
    33
    44To define a many-to-one relationship between a model and itself, use
    55``ForeignKey('self')``.
  • tests/modeltests/manipulators/models.py

     
    11"""
    2 27. Default manipulators
     224. Default manipulators
    33
    44Each model gets an AddManipulator and ChangeManipulator by default.
    55"""
  • tests/modeltests/many_to_many/models.py

     
    11"""
    2 5. Many-to-many relationships
     23. Many-to-many relationships
    33
    44To define a many-to-many relationship, use ManyToManyField().
    55
  • tests/modeltests/many_to_one/models.py

     
    11"""
    2 4. Many-to-one relationships
     22. Many-to-one relationships
    33
    44To define a many-to-one relationship, use ``ForeignKey()`` .
    55"""
  • tests/modeltests/many_to_one_null/models.py

     
    11"""
    2 16. Many-to-one relationships that can be null
     213. Many-to-one relationships that can be null
    33
    44To define a many-to-one relationship that can have a null foreign key, use
    55``ForeignKey()`` with ``null=True`` .
  • tests/modeltests/mutually_referential/models.py

     
    11"""
    2 24. Mutually referential many-to-one relationships
     221. Mutually referential many-to-one relationships
    33
    44To define a many-to-one relationship, use ``ForeignKey()`` .
    55"""
  • tests/modeltests/one_to_one/models.py

     
    11"""
    2 10. One-to-one relationships
     28. One-to-one relationships
    33
    44To define a one-to-one relationship, use ``OneToOneField()``.
    55
  • tests/modeltests/or_lookups/models.py

     
    11"""
    2 19. OR lookups
     216. OR lookups
    33
    44To perform an OR lookup, or a lookup that combines ANDs and ORs,
    55combine QuerySet objects using & and | operators.
  • tests/modeltests/ordering/models.py

     
    11"""
    2 6. Specifying ordering
     24. Specifying ordering
    33
    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 the
  • tests/modeltests/pagination/models.py

     
    11"""
    2 30. Object pagination
     227. Object pagination
    33
    44Django provides a framework for paginating a list of objects in a few lines
    55of code. This is often useful for dividing search results or long lists of
  • tests/modeltests/properties/models.py

     
    11"""
    2 22. Using properties on models
     219. Using properties on models
    33
    44Use properties on models just like on any other Python object.
    55"""
  • tests/modeltests/reserved_names/models.py

     
    11"""
    2 18. Using SQL reserved names
     215. Using SQL reserved names
    33
    44Need to use a reserved SQL name as a column name or table name? Need to include
    55a hyphen in a column or table name? No problem. Django quotes names
  • tests/modeltests/reverse_lookup/models.py

     
    11"""
    2 25. Reverse lookups
     222. Reverse lookups
    33
    44This demonstrates the reverse lookup features of the database API.
    55"""
  • tests/modeltests/save_delete_hooks/models.py

     
    11"""
    2 13. Adding hooks before/after saving and deleting
     211. Adding hooks before/after saving and deleting
    33
    44To execute arbitrary code around ``save()`` and ``delete()``, just subclass
    55the methods.
  • tests/modeltests/select_related/models.py

     
    11"""
    2 41. Tests for select_related()
     236. Tests for select_related()
    33
    44``select_related()`` follows all relationships and pre-caches any foreign key
    55values so that complex trees can be fetched in a single query. However, this
  • tests/modeltests/transactions/models.py

     
    11"""
    2 15. Transactions
     212. Transactions
    33
    44Django handles transactions in three different ways. The default is to commit
    55each transaction upon a write, but you can decorate a function to get
  • tests/modeltests/user_commands/models.py

     
    11"""
    2 38. User-registered management commands
     234. User-registered management commands
    33
    44The 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.
  • tests/modeltests/validation/models.py

     
    11"""
    2 31. Validation
     228. Validation
    33
    44This is an experimental feature!
    55
Back to Top