Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added value_from_object method to db Field class

git-svn-id: http://code.djangoproject.com/svn/django/trunk@4252 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 34dce706ee9ac30d950d95e1647aadbed2a70921 1 parent f974b1b
Adrian Holovaty authored
4  django/db/models/fields/__init__.py
@@ -339,6 +339,10 @@ def formfield(self, initial=None):
339 339
         # TODO: This is just a temporary default during development.
340 340
         return forms.CharField(required=not self.blank, label=capfirst(self.verbose_name), initial=initial)
341 341
 
  342
+    def value_from_object(self, obj):
  343
+        "Returns the value of this field in the given model instance."
  344
+        return getattr(obj, self.attname)
  345
+
342 346
 class AutoField(Field):
343 347
     empty_strings_allowed = False
344 348
     def __init__(self, *args, **kwargs):
4  django/db/models/fields/related.py
@@ -721,6 +721,10 @@ def contribute_to_related_class(self, cls, related):

0 notes on commit 34dce70

Please sign in to comment.
Something went wrong with that request. Please try again.