diff --git a/tests/basic/models.py b/tests/basic/models.py index d9fa08a056..5496e6b409 100644 --- a/tests/basic/models.py +++ b/tests/basic/models.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- """ -1. Bare-bones model +Bare-bones model This is a basic model with only two non-primary-key fields. """ diff --git a/tests/choices/models.py b/tests/choices/models.py index 4fcef6f48f..e33d45733a 100644 --- a/tests/choices/models.py +++ b/tests/choices/models.py @@ -1,5 +1,5 @@ """ -21. Specifying 'choices' for a field +Specifying 'choices' for a field Most fields take a ``choices`` parameter, which should be a tuple of tuples specifying which are the valid values for that field. diff --git a/tests/custom_columns/models.py b/tests/custom_columns/models.py index 6126183ca9..a3e8b614aa 100644 --- a/tests/custom_columns/models.py +++ b/tests/custom_columns/models.py @@ -1,5 +1,5 @@ """ -17. Custom column/table names +Custom column/table names If your database column name is different than your model attribute, use the ``db_column`` parameter. Note that you'll use the field's name, not its column diff --git a/tests/custom_managers/models.py b/tests/custom_managers/models.py index feda9ef630..cecfd2c948 100644 --- a/tests/custom_managers/models.py +++ b/tests/custom_managers/models.py @@ -1,5 +1,5 @@ """ -23. Giving models a custom manager +Giving models a custom manager You can use a custom ``Manager`` in a particular model by extending the base ``Manager`` class and instantiating your custom ``Manager`` in your model. diff --git a/tests/custom_methods/models.py b/tests/custom_methods/models.py index 78e00a99b8..e21f0a6bd4 100644 --- a/tests/custom_methods/models.py +++ b/tests/custom_methods/models.py @@ -1,5 +1,5 @@ """ -3. Giving models custom methods +Giving models custom methods Any method you add to a model will be available to instances. """ diff --git a/tests/custom_pk/models.py b/tests/custom_pk/models.py index bfa6777b10..f4ecc874ee 100644 --- a/tests/custom_pk/models.py +++ b/tests/custom_pk/models.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- """ -14. Using a custom primary key +Using a custom primary key By default, Django adds an ``"id"`` field to each model. But you can override this behavior by explicitly adding ``primary_key=True`` to a field. diff --git a/tests/empty/models.py b/tests/empty/models.py index a6cdb0aa22..ee05787e43 100644 --- a/tests/empty/models.py +++ b/tests/empty/models.py @@ -1,5 +1,5 @@ """ -40. Empty model tests +Empty model tests These test that things behave sensibly for the rare corner-case of a model with no fields. diff --git a/tests/field_defaults/models.py b/tests/field_defaults/models.py index c99d4871cd..4f06232011 100644 --- a/tests/field_defaults/models.py +++ b/tests/field_defaults/models.py @@ -1,6 +1,6 @@ # coding: utf-8 """ -32. Callable defaults +Callable defaults You can pass callable objects as the ``default`` parameter to a field. When the object is created without an explicit value passed in, Django will call diff --git a/tests/file_storage/models.py b/tests/file_storage/models.py index 1ce9a26956..126cd202aa 100644 --- a/tests/file_storage/models.py +++ b/tests/file_storage/models.py @@ -1,5 +1,5 @@ """ -42. Storing files according to a custom storage system +Storing files according to a custom storage system ``FileField`` and its variations can take a ``storage`` argument to specify how and where files should be stored. diff --git a/tests/fixtures/models.py b/tests/fixtures/models.py index 30ffe9e8fe..faa09f8eff 100644 --- a/tests/fixtures/models.py +++ b/tests/fixtures/models.py @@ -1,5 +1,5 @@ """ -37. Fixtures. +Fixtures. Fixtures are a way of loading data into the database in bulk. Fixure data can be stored in any serializable format (including JSON and XML). Fixtures diff --git a/tests/generic_relations/models.py b/tests/generic_relations/models.py index 5d24e017a2..004ca080a1 100644 --- a/tests/generic_relations/models.py +++ b/tests/generic_relations/models.py @@ -1,5 +1,5 @@ """ -34. Generic relations +Generic relations Generic relations let an object have a foreign key to any object through a content-type/object-id field. A ``GenericForeignKey`` field can point to any diff --git a/tests/get_object_or_404/models.py b/tests/get_object_or_404/models.py index ea6e3e40d5..4460e46642 100644 --- a/tests/get_object_or_404/models.py +++ b/tests/get_object_or_404/models.py @@ -1,5 +1,5 @@ """ -35. DB-API Shortcuts +DB-API Shortcuts ``get_object_or_404()`` is a shortcut function to be used in view functions for performing a ``get()`` lookup and raising a ``Http404`` exception if a diff --git a/tests/lookup/models.py b/tests/lookup/models.py index 0b4c88b8ed..735602b324 100644 --- a/tests/lookup/models.py +++ b/tests/lookup/models.py @@ -1,5 +1,5 @@ """ -7. The lookup API +The lookup API This demonstrates features of the database API. """ diff --git a/tests/m2m_and_m2o/models.py b/tests/m2m_and_m2o/models.py index 482ae9a1fa..753820fade 100644 --- a/tests/m2m_and_m2o/models.py +++ b/tests/m2m_and_m2o/models.py @@ -1,5 +1,5 @@ """ -29. Many-to-many and many-to-one relationships to the same table +Many-to-many and many-to-one relationships to the same table Make sure to set ``related_name`` if you use relationships to the same table. """ diff --git a/tests/m2m_intermediary/models.py b/tests/m2m_intermediary/models.py index 9b194e321b..e853984be5 100644 --- a/tests/m2m_intermediary/models.py +++ b/tests/m2m_intermediary/models.py @@ -1,5 +1,5 @@ """ -9. Many-to-many relationships via an intermediary table +Many-to-many relationships via an intermediary table For many-to-many relationships that need extra fields on the intermediary table, use an intermediary model. diff --git a/tests/m2m_multiple/models.py b/tests/m2m_multiple/models.py index 9c5b755905..a6db9425bd 100644 --- a/tests/m2m_multiple/models.py +++ b/tests/m2m_multiple/models.py @@ -1,5 +1,5 @@ """ -20. Multiple many-to-many relationships between the same two tables +Multiple many-to-many relationships between the same two tables In this example, an ``Article`` can have many "primary" ``Category`` objects and many "secondary" ``Category`` objects. diff --git a/tests/m2m_recursive/models.py b/tests/m2m_recursive/models.py index b69930208c..d224b3d572 100644 --- a/tests/m2m_recursive/models.py +++ b/tests/m2m_recursive/models.py @@ -1,5 +1,5 @@ """ -28. Many-to-many relationships between the same two tables +Many-to-many relationships between the same two tables In this example, a ``Person`` can have many friends, who are also ``Person`` objects. Friendship is a symmetrical relationship - if I am your friend, you diff --git a/tests/m2o_recursive/models.py b/tests/m2o_recursive/models.py index b41e0cb0a3..ac6ca8451d 100644 --- a/tests/m2o_recursive/models.py +++ b/tests/m2o_recursive/models.py @@ -1,5 +1,5 @@ """ -11. Relating an object to itself, many-to-one +Relating an object to itself, many-to-one To define a many-to-one relationship between a model and itself, use ``ForeignKey('self')``. diff --git a/tests/many_to_many/models.py b/tests/many_to_many/models.py index eaf98ce565..9e578e4e0b 100644 --- a/tests/many_to_many/models.py +++ b/tests/many_to_many/models.py @@ -1,5 +1,5 @@ """ -5. Many-to-many relationships +Many-to-many relationships To define a many-to-many relationship, use ``ManyToManyField()``. diff --git a/tests/many_to_one/models.py b/tests/many_to_one/models.py index 0b45ff0ef3..6451d9ff2f 100644 --- a/tests/many_to_one/models.py +++ b/tests/many_to_one/models.py @@ -1,5 +1,5 @@ """ -4. Many-to-one relationships +Many-to-one relationships To define a many-to-one relationship, use ``ForeignKey()``. """ diff --git a/tests/many_to_one_null/models.py b/tests/many_to_one_null/models.py index 3b03c42105..3cf8a512ab 100644 --- a/tests/many_to_one_null/models.py +++ b/tests/many_to_one_null/models.py @@ -1,5 +1,5 @@ """ -16. Many-to-one relationships that can be null +Many-to-one relationships that can be null To define a many-to-one relationship that can have a null foreign key, use ``ForeignKey()`` with ``null=True`` . diff --git a/tests/mutually_referential/models.py b/tests/mutually_referential/models.py index 230a1ec237..e5b5b787bf 100644 --- a/tests/mutually_referential/models.py +++ b/tests/mutually_referential/models.py @@ -1,5 +1,5 @@ """ -24. Mutually referential many-to-one relationships +Mutually referential many-to-one relationships Strings can be used instead of model literals to set up "lazy" relations. """ diff --git a/tests/one_to_one/models.py b/tests/one_to_one/models.py index 88b0ef6dcf..3c204e5c92 100644 --- a/tests/one_to_one/models.py +++ b/tests/one_to_one/models.py @@ -1,5 +1,5 @@ """ -10. One-to-one relationships +One-to-one relationships To define a one-to-one relationship, use ``OneToOneField()``. diff --git a/tests/or_lookups/models.py b/tests/or_lookups/models.py index 76a861dcce..7dea8cd49e 100644 --- a/tests/or_lookups/models.py +++ b/tests/or_lookups/models.py @@ -1,5 +1,5 @@ """ -19. OR lookups +OR lookups To perform an OR lookup, or a lookup that combines ANDs and ORs, combine ``QuerySet`` objects using ``&`` and ``|`` operators. diff --git a/tests/ordering/models.py b/tests/ordering/models.py index 2ab16f3c5f..57a75027f6 100644 --- a/tests/ordering/models.py +++ b/tests/ordering/models.py @@ -1,5 +1,5 @@ """ -6. Specifying ordering +Specifying ordering Specify default ordering for a model using the ``ordering`` attribute, which should be a list or tuple of field names. This tells Django how to order diff --git a/tests/properties/models.py b/tests/properties/models.py index 5c2656570c..913c9edf00 100644 --- a/tests/properties/models.py +++ b/tests/properties/models.py @@ -1,5 +1,5 @@ """ -22. Using properties on models +Using properties on models Use properties on models just like on any other Python object. """ diff --git a/tests/reserved_names/models.py b/tests/reserved_names/models.py index 3a14165a32..e3806ab550 100644 --- a/tests/reserved_names/models.py +++ b/tests/reserved_names/models.py @@ -1,5 +1,5 @@ """ -18. Using SQL reserved names +Using SQL reserved names Need to use a reserved SQL name as a column name or table name? Need to include a hyphen in a column or table name? No problem. Django quotes names diff --git a/tests/reverse_lookup/models.py b/tests/reverse_lookup/models.py index b216c03120..4f328dd063 100644 --- a/tests/reverse_lookup/models.py +++ b/tests/reverse_lookup/models.py @@ -1,5 +1,5 @@ """ -25. Reverse lookups +Reverse lookups This demonstrates the reverse lookup features of the database API. """ diff --git a/tests/save_delete_hooks/models.py b/tests/save_delete_hooks/models.py index abba693778..e6a155a8e7 100644 --- a/tests/save_delete_hooks/models.py +++ b/tests/save_delete_hooks/models.py @@ -1,5 +1,5 @@ """ -13. Adding hooks before/after saving and deleting +Adding hooks before/after saving and deleting To execute arbitrary code around ``save()`` and ``delete()``, just subclass the methods. diff --git a/tests/select_related/models.py b/tests/select_related/models.py index 93d699f73e..13170e7e69 100644 --- a/tests/select_related/models.py +++ b/tests/select_related/models.py @@ -1,5 +1,5 @@ """ -41. Tests for select_related() +Tests for select_related() ``select_related()`` follows all relationships and pre-caches any foreign key values so that complex trees can be fetched in a single query. However, this diff --git a/tests/serializers/models.py b/tests/serializers/models.py index 78674664d3..2d1ab9758b 100644 --- a/tests/serializers/models.py +++ b/tests/serializers/models.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- """ -42. Serialization +Serialization ``django.core.serializers`` provides interfaces to converting Django ``QuerySet`` objects to and from "flat" data (i.e. strings). diff --git a/tests/str/models.py b/tests/str/models.py index e203de411e..e606e912aa 100644 --- a/tests/str/models.py +++ b/tests/str/models.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- """ -2. Adding __str__() or __unicode__() to models +Adding __str__() or __unicode__() to models Although it's not a strict requirement, each model should have a ``_str__()`` or ``__unicode__()`` method to return a "human-readable" diff --git a/tests/test_client/tests.py b/tests/test_client/tests.py index a14d1ebef1..034bb95b41 100644 --- a/tests/test_client/tests.py +++ b/tests/test_client/tests.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- """ -39. Testing using the Test Client +Testing using the Test Client The test client is a class that can act like a simple browser for testing purposes. diff --git a/tests/transactions/models.py b/tests/transactions/models.py index 6c2bcfd23f..f4400363e5 100644 --- a/tests/transactions/models.py +++ b/tests/transactions/models.py @@ -1,5 +1,5 @@ """ -15. Transactions +Transactions Django handles transactions in three different ways. The default is to commit each transaction upon a write, but you can decorate a function to get diff --git a/tests/user_commands/models.py b/tests/user_commands/models.py index f2aa549bb9..51fd45333c 100644 --- a/tests/user_commands/models.py +++ b/tests/user_commands/models.py @@ -1,5 +1,5 @@ """ -38. User-registered management commands +User-registered management commands The ``manage.py`` utility provides a number of useful commands for managing a Django project. If you want to add a utility command of your own, you can.