mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
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
5 changed files with 26 additions and 12 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue