1
0
mirror of https://github.com/django/django.git synced 2025-10-30 17:16:10 +00:00

magic-removal: Added Manager.__get__ method that forbids access by instances. Also added unit tests. Thanks, rjwittams

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1615 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty
2005-12-13 16:44:54 +00:00
parent 0438b6848b
commit 257f7090ef
2 changed files with 18 additions and 1 deletions

View File

@@ -180,6 +180,18 @@ False
>>> Article.objects.get_pub_date_list('day', order='DESC')
[datetime.datetime(2005, 7, 31, 0, 0), datetime.datetime(2005, 7, 30, 0, 0), datetime.datetime(2005, 7, 29, 0, 0), datetime.datetime(2005, 7, 28, 0, 0)]
# An Article instance doesn't have access to the "objects" attribute.
# That is only available as a class method.
>>> a7.objects.get_list()
Traceback (most recent call last):
...
AttributeError: Manager isn't accessible via Article instances
>>> a7.objects
Traceback (most recent call last):
...
AttributeError: Manager isn't accessible via Article instances
"""
from django.conf import settings