Added blurbs to the model unit tests that didn't have them
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3028 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
1bf991abb3
commit
3daae59aab
|
@ -1,5 +1,12 @@
|
|||
"""
|
||||
23. 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.
|
||||
|
||||
There are two reasons you might want to customize a ``Manager``: to add extra
|
||||
``Manager`` methods, and/or to modify the initial ``QuerySet`` the ``Manager``
|
||||
returns.
|
||||
"""
|
||||
|
||||
from django.db import models
|
||||
|
@ -19,7 +26,7 @@ class Person(models.Model):
|
|||
def __repr__(self):
|
||||
return "%s %s" % (self.first_name, self.last_name)
|
||||
|
||||
# An example of a custom manager that sets a core_filter on its lookups.
|
||||
# An example of a custom manager that sets get_query_set().
|
||||
|
||||
class PublishedBookManager(models.Manager):
|
||||
def get_query_set(self):
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
"""
|
||||
26. A test to check that the model validator works can correctly identify errors in a model.
|
||||
26. Invalid models
|
||||
|
||||
This example exists purely to point out errors in models.
|
||||
"""
|
||||
|
||||
from django.db import models
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
"""
|
||||
25. Default manipulators
|
||||
|
||||
Each model gets an AddManipulator and ChangeManipulator by default.
|
||||
"""
|
||||
|
||||
from django.db import models
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""
|
||||
XX. Model inheritance
|
||||
|
||||
Model inheritance isn't yet supported.
|
||||
"""
|
||||
|
||||
from django.db import models
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
"""
|
||||
22. Using properties on models
|
||||
|
||||
Use properties on models just like on any other Python object.
|
||||
"""
|
||||
|
||||
from django.db import models
|
||||
|
|
Loading…
Reference in New Issue