1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Removed numbering from the models.py header of some test packages.

This is a reliqua from the early days of the modeltests/regressiontests era.
This commit is contained in:
Loic Bistuer 2014-09-24 12:13:13 +07:00
parent d128eac316
commit 2f3a4cd573
35 changed files with 35 additions and 35 deletions

View File

@ -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.
"""

View File

@ -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.

View File

@ -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

View File

@ -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.

View File

@ -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.
"""

View File

@ -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.

View File

@ -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.

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,5 +1,5 @@
"""
7. The lookup API
The lookup API
This demonstrates features of the database API.
"""

View File

@ -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.
"""

View File

@ -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.

View File

@ -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.

View File

@ -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

View File

@ -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')``.

View File

@ -1,5 +1,5 @@
"""
5. Many-to-many relationships
Many-to-many relationships
To define a many-to-many relationship, use ``ManyToManyField()``.

View File

@ -1,5 +1,5 @@
"""
4. Many-to-one relationships
Many-to-one relationships
To define a many-to-one relationship, use ``ForeignKey()``.
"""

View File

@ -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`` .

View File

@ -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.
"""

View File

@ -1,5 +1,5 @@
"""
10. One-to-one relationships
One-to-one relationships
To define a one-to-one relationship, use ``OneToOneField()``.

View File

@ -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.

View File

@ -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

View File

@ -1,5 +1,5 @@
"""
22. Using properties on models
Using properties on models
Use properties on models just like on any other Python object.
"""

View File

@ -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

View File

@ -1,5 +1,5 @@
"""
25. Reverse lookups
Reverse lookups
This demonstrates the reverse lookup features of the database API.
"""

View File

@ -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.

View File

@ -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

View File

@ -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).

View File

@ -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"

View File

@ -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.

View File

@ -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

View File

@ -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.