Code

Ticket #12568: subfieldbase-fix.diff

File subfieldbase-fix.diff, 502 bytes (added by specialunderwear, 4 years ago)
Line 
1Index: django/db/models/fields/subclassing.py
2===================================================================
3--- django/db/models/fields/subclassing.py      (revision 12169)
4+++ django/db/models/fields/subclassing.py      (working copy)
5@@ -91,7 +91,7 @@
6 
7     def __get__(self, obj, type=None):
8         if obj is None:
9-            raise AttributeError('Can only be accessed via an instance.')
10+             return self
11         return obj.__dict__[self.field.name]
12 
13     def __set__(self, obj, value):