diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2006-05-22 04:59:22 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2006-05-22 04:59:22 +0000 |
| commit | a9039dc6b3a01f9af225f699a7da930d99ecdcea (patch) | |
| tree | 16e6c2893c4e73ffed6855b85cddba9ac83224cd | |
| parent | e3839f32e5c3c9492c0a29b3af4da28f38a3ccda (diff) | |
Added django.contrib.sites.managers, which contains CurrentSiteManager. Thanks, Ian Holsman
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2959 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/contrib/sites/managers.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/django/contrib/sites/managers.py b/django/contrib/sites/managers.py new file mode 100644 index 0000000000..fb698f22e1 --- /dev/null +++ b/django/contrib/sites/managers.py @@ -0,0 +1,11 @@ +from django.db import models +from django.conf import settings + +class CurrentSiteManager(models.Manager): + "Use this to limit objects to those associated with the current site." + def __init__(self, field_name='site') + super(SiteLimitManager, self).__init__() + self.__lookup = field_name + '__id__exact' + + def get_query_set(self): + return super(SiteLimitManager, self).get_query_set().filter(self.__lookup=settings.SITE_ID) |
