Ticket #5480: 5480.diff
File 5480.diff, 18.2 KB (added by , 17 years ago) |
---|
-
tests/modeltests/select_related/models.py
1 1 """ 2 40.Tests for select_related()2 Tests for select_related() 3 3 4 4 ``select_related()`` follows all relationships and pre-caches any foreign key 5 5 values so that complex trees can be fetched in a single query. However, this -
tests/modeltests/basic/models.py
1 1 # coding: utf-8 2 2 """ 3 1.Bare-bones model3 Bare-bones model 4 4 5 5 This is a basic model with only two non-primary-key fields. 6 6 """ -
tests/modeltests/m2m_recursive/models.py
1 1 """ 2 28.Many-to-many relationships between the same two tables2 Many-to-many relationships between the same two tables 3 3 4 4 In this example, A Person can have many friends, who are also people. Friendship is a 5 5 symmetrical relationship - if I am your friend, you are my friend. -
tests/modeltests/one_to_one/models.py
1 1 """ 2 10.One-to-one relationships2 One-to-one relationships 3 3 4 4 To define a one-to-one relationship, use ``OneToOneField()``. 5 5 -
tests/modeltests/m2o_recursive/models.py
1 1 """ 2 11.Relating an object to itself, many-to-one2 Relating an object to itself, many-to-one 3 3 4 4 To define a many-to-one relationship between a model and itself, use 5 5 ``ForeignKey('self')``. -
tests/modeltests/custom_managers/models.py
1 1 """ 2 23.Giving models a custom manager2 Giving models a custom manager 3 3 4 4 You can use a custom ``Manager`` in a particular model by extending the base 5 5 ``Manager`` class and instantiating your custom ``Manager`` in your model. -
tests/modeltests/invalid_models/models.py
1 1 """ 2 26.Invalid models2 Invalid models 3 3 4 4 This example exists purely to point out errors in models. 5 5 """ -
tests/modeltests/many_to_many/models.py
1 1 """ 2 5.Many-to-many relationships2 Many-to-many relationships 3 3 4 4 To define a many-to-many relationship, use ManyToManyField(). 5 5 -
tests/modeltests/m2m_and_m2o/models.py
1 1 """ 2 29.Many-to-many and many-to-one relationships to the same table2 Many-to-many and many-to-one relationships to the same table 3 3 4 4 Make sure to set ``related_name`` if you use relationships to the same table. 5 5 """ -
tests/modeltests/validation/models.py
1 1 """ 2 31.Validation2 Validation 3 3 4 4 This is an experimental feature! 5 5 -
tests/modeltests/or_lookups/models.py
1 1 """ 2 19.OR lookups2 OR lookups 3 3 4 4 To perform an OR lookup, or a lookup that combines ANDs and ORs, 5 5 combine QuerySet objects using & and | operators. -
tests/modeltests/mutually_referential/models.py
1 1 """ 2 24.Mutually referential many-to-one relationships2 Mutually referential many-to-one relationships 3 3 4 4 To define a many-to-one relationship, use ``ForeignKey()`` . 5 5 """ -
tests/modeltests/custom_methods/models.py
1 1 """ 2 3.Giving models custom methods2 Giving models custom methods 3 3 4 4 Any method you add to a model will be available to instances. 5 5 """ -
tests/modeltests/empty/models.py
1 1 """ 2 39.Empty model tests2 Empty model tests 3 3 4 4 These test that things behave sensibly for the rare corner-case of a model with 5 5 no fields. -
tests/modeltests/many_to_one_null/models.py
1 1 """ 2 16.Many-to-one relationships that can be null2 Many-to-one relationships that can be null 3 3 4 4 To define a many-to-one relationship that can have a null foreign key, use 5 5 ``ForeignKey()`` with ``null=True`` . -
tests/modeltests/get_or_create/models.py
1 1 """ 2 33.get_or_create()2 get_or_create() 3 3 4 4 get_or_create() does what it says: it tries to look up an object with the given 5 5 parameters. If an object isn't found, it creates one with the given parameters. -
tests/modeltests/custom_pk/models.py
1 1 # -*- coding: utf-8 -*- 2 2 """ 3 14.Using a custom primary key3 Using a custom primary key 4 4 5 5 By default, Django adds an ``"id"`` field to each model. But you can override 6 6 this behavior by explicitly adding ``primary_key=True`` to a field. -
tests/modeltests/reverse_lookup/models.py
1 1 """ 2 25.Reverse lookups2 Reverse lookups 3 3 4 4 This demonstrates the reverse lookup features of the database API. 5 5 """ -
tests/modeltests/m2o_recursive2/models.py
1 1 """ 2 12.Relating a model to another model more than once2 Relating a model to another model more than once 3 3 4 4 In this example, a ``Person`` can have a ``mother`` and ``father`` -- both of 5 5 which are other ``Person`` objects. -
tests/modeltests/m2m_multiple/models.py
1 1 """ 2 20.Multiple many-to-many relationships between the same two tables2 Multiple many-to-many relationships between the same two tables 3 3 4 4 In this example, an Article can have many Categories (as "primary") and many 5 5 Categories (as "secondary"). -
tests/modeltests/m2m_intermediary/models.py
1 1 """ 2 9.Many-to-many relationships via an intermediary table2 Many-to-many relationships via an intermediary table 3 3 4 4 For many-to-many relationships that need extra fields on the intermediary 5 5 table, use an intermediary model. -
tests/modeltests/str/models.py
1 1 # -*- coding: utf-8 -*- 2 2 """ 3 2.Adding __str__() or __unicode__() to models3 Adding __str__() or __unicode__() to models 4 4 5 5 Although it's not a strict requirement, each model should have a 6 6 ``_str__()`` or ``__unicode__()`` method to return a "human-readable" -
tests/modeltests/transactions/models.py
1 1 """ 2 15.Transactions2 Transactions 3 3 4 4 Django handles transactions in three different ways. The default is to commit 5 5 each transaction upon a write, but you can decorate a function to get -
tests/modeltests/model_inheritance/models.py
1 1 """ 2 XX.Model inheritance2 Model inheritance 3 3 4 4 Model inheritance isn't yet supported. 5 5 """ -
tests/modeltests/lookup/models.py
1 1 """ 2 7.The lookup API2 The lookup API 3 3 4 4 This demonstrates features of the database API. 5 5 """ -
tests/modeltests/choices/models.py
1 1 """ 2 21.Specifying 'choices' for a field2 Specifying 'choices' for a field 3 3 4 4 Most fields take a ``choices`` parameter, which should be a tuple of tuples 5 5 specifying which are the valid values for that field. -
tests/modeltests/save_delete_hooks/models.py
1 1 """ 2 13.Adding hooks before/after saving and deleting2 Adding hooks before/after saving and deleting 3 3 4 4 To execute arbitrary code around ``save()`` and ``delete()``, just subclass 5 5 the methods. -
tests/modeltests/pagination/models.py
1 1 """ 2 30.Object pagination2 Object pagination 3 3 4 4 Django provides a framework for paginating a list of objects in a few lines 5 5 of code. This is often useful for dividing search results or long lists of -
tests/modeltests/get_latest/models.py
1 1 """ 2 8.get_latest_by2 get_latest_by 3 3 4 4 Models can have a ``get_latest_by`` attribute, which should be set to the name 5 5 of a DateField or DateTimeField. If ``get_latest_by`` exists, the model's -
tests/modeltests/generic_relations/models.py
1 1 """ 2 34.Generic relations2 Generic relations 3 3 4 4 Generic relations let an object have a foreign key to any object through a 5 5 content-type/object-id field. A generic foreign key can point to any object, -
tests/modeltests/get_object_or_404/models.py
1 1 """ 2 35.DB-API Shortcuts2 DB-API Shortcuts 3 3 4 4 get_object_or_404 is a shortcut function to be used in view functions for 5 5 performing a get() lookup and raising a Http404 exception if a DoesNotExist -
tests/modeltests/properties/models.py
1 1 """ 2 22.Using properties on models2 Using properties on models 3 3 4 4 Use properties on models just like on any other Python object. 5 5 """ -
tests/modeltests/serializers/models.py
1 1 # -*- coding: utf-8 -*- 2 2 """ 3 41.Serialization3 Serialization 4 4 5 5 ``django.core.serializers`` provides interfaces to converting Django querysets 6 6 to and from "flat" data (i.e. strings). -
tests/modeltests/user_commands/models.py
1 1 """ 2 37.User-registered management commands2 User-registered management commands 3 3 4 4 The manage.py utility provides a number of useful commands for managing a 5 5 Django project. If you want to add a utility command of your own, you can. -
tests/modeltests/reserved_names/models.py
1 1 """ 2 18.Using SQL reserved names2 Using SQL reserved names 3 3 4 4 Need to use a reserved SQL name as a column name or table name? Need to include 5 5 a hyphen in a column or table name? No problem. Django quotes names -
tests/modeltests/model_forms/models.py
1 1 """ 2 36.Generating HTML forms from models2 Generating HTML forms from models 3 3 4 4 Django provides shortcuts for creating Form objects from a model class and a 5 5 model instance. -
tests/modeltests/many_to_one/models.py
1 1 """ 2 4.Many-to-one relationships2 Many-to-one relationships 3 3 4 4 To define a many-to-one relationship, use ``ForeignKey()`` . 5 5 """ -
tests/modeltests/fixtures/models.py
1 1 """ 2 37.Fixtures.2 Fixtures. 3 3 4 4 Fixtures are a way of loading data into the database in bulk. Fixure data 5 5 can be stored in any serializable format (including JSON and XML). Fixtures -
tests/modeltests/ordering/models.py
1 1 """ 2 6.Specifying ordering2 Specifying ordering 3 3 4 4 Specify default ordering for a model using the ``ordering`` attribute, which 5 5 should be a list or tuple of field names. This tells Django how to order the -
tests/modeltests/custom_columns/models.py
1 1 """ 2 17.Custom column/table names2 Custom column/table names 3 3 4 4 If your database column name is different than your model attribute, use the 5 5 ``db_column`` parameter. Note that you'll use the field's name, not its column -
tests/modeltests/field_defaults/models.py
1 1 """ 2 32.Callable defaults2 Callable defaults 3 3 4 4 You can pass callable objects as the ``default`` parameter to a field. When 5 5 the object is created without an explicit value passed in, Django will call -
tests/modeltests/test_client/models.py
1 1 # coding: utf-8 2 2 """ 3 38.Testing using the Test Client3 Testing using the Test Client 4 4 5 5 The test client is a class that can act like a simple 6 6 browser for testing purposes. -
tests/modeltests/manipulators/models.py
1 1 """ 2 27.Default manipulators2 Default manipulators 3 3 4 4 Each model gets an AddManipulator and ChangeManipulator by default. 5 5 """