Ticket #5480: 5480.patch
File 5480.patch, 15.6 KB (added by , 17 years ago) |
---|
-
tests/modeltests/choices/models.py
1 1 """ 2 21. Specifying 'choices' for a field2 18. 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/custom_columns/models.py
1 1 """ 2 1 7. Custom column/table names2 14. 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/custom_managers/models.py
1 1 """ 2 2 3. Giving models a custom manager2 20. 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/custom_methods/models.py
1 1 """ 2 3. Giving models custom methods2 1. 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 40. Empty model tests2 35. 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/field_defaults/models.py
1 1 """ 2 32. Callable defaults2 29. 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/fixtures/models.py
1 1 """ 2 3 7. Fixtures.2 33. 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/generic_relations/models.py
1 1 """ 2 3 4. Generic relations2 31. 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_latest/models.py
1 1 """ 2 8. get_latest_by2 6. 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/get_object_or_404/models.py
1 1 """ 2 3 5. DB-API Shortcuts2 32. 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/get_or_create/models.py
1 1 """ 2 3 3. get_or_create()2 30. 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/invalid_models/models.py
1 1 """ 2 2 6. Invalid models2 23. Invalid models 3 3 4 4 This example exists purely to point out errors in models. 5 5 """ -
tests/modeltests/lookup/models.py
1 1 """ 2 7. The lookup API2 5. The lookup API 3 3 4 4 This demonstrates features of the database API. 5 5 """ -
tests/modeltests/m2m_and_m2o/models.py
1 1 """ 2 2 9. Many-to-many and many-to-one relationships to the same table2 26. 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/m2m_intermediary/models.py
1 1 """ 2 9. Many-to-many relationships via an intermediary table2 7. 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/m2m_multiple/models.py
1 1 """ 2 20. Multiple many-to-many relationships between the same two tables2 17. 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_recursive/models.py
1 1 """ 2 2 8. Many-to-many relationships between the same two tables2 25. 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/m2o_recursive2/models.py
1 1 """ 2 1 2. Relating a model to another model more than once2 10. 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/m2o_recursive/models.py
1 1 """ 2 11. Relating an object to itself, many-to-one2 9. 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/manipulators/models.py
1 1 """ 2 2 7. Default manipulators2 24. Default manipulators 3 3 4 4 Each model gets an AddManipulator and ChangeManipulator by default. 5 5 """ -
tests/modeltests/many_to_many/models.py
1 1 """ 2 5. Many-to-many relationships2 3. Many-to-many relationships 3 3 4 4 To define a many-to-many relationship, use ManyToManyField(). 5 5 -
tests/modeltests/many_to_one/models.py
1 1 """ 2 4. Many-to-one relationships2 2. Many-to-one relationships 3 3 4 4 To define a many-to-one relationship, use ``ForeignKey()`` . 5 5 """ -
tests/modeltests/many_to_one_null/models.py
1 1 """ 2 1 6. Many-to-one relationships that can be null2 13. 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/mutually_referential/models.py
1 1 """ 2 2 4. Mutually referential many-to-one relationships2 21. Mutually referential many-to-one relationships 3 3 4 4 To define a many-to-one relationship, use ``ForeignKey()`` . 5 5 """ -
tests/modeltests/one_to_one/models.py
1 1 """ 2 10. One-to-one relationships2 8. One-to-one relationships 3 3 4 4 To define a one-to-one relationship, use ``OneToOneField()``. 5 5 -
tests/modeltests/or_lookups/models.py
1 1 """ 2 1 9. OR lookups2 16. 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/ordering/models.py
1 1 """ 2 6. Specifying ordering2 4. 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/pagination/models.py
1 1 """ 2 30. Object pagination2 27. 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/properties/models.py
1 1 """ 2 22. Using properties on models2 19. Using properties on models 3 3 4 4 Use properties on models just like on any other Python object. 5 5 """ -
tests/modeltests/reserved_names/models.py
1 1 """ 2 1 8. Using SQL reserved names2 15. 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/reverse_lookup/models.py
1 1 """ 2 2 5. Reverse lookups2 22. Reverse lookups 3 3 4 4 This demonstrates the reverse lookup features of the database API. 5 5 """ -
tests/modeltests/save_delete_hooks/models.py
1 1 """ 2 1 3. Adding hooks before/after saving and deleting2 11. 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/select_related/models.py
1 1 """ 2 41. Tests for select_related()2 36. 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/transactions/models.py
1 1 """ 2 1 5. Transactions2 12. 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/user_commands/models.py
1 1 """ 2 3 8. User-registered management commands2 34. 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/validation/models.py
1 1 """ 2 31. Validation2 28. Validation 3 3 4 4 This is an experimental feature! 5 5