1
0
mirror of https://github.com/django/django.git synced 2025-07-05 02:09:13 +00:00

Fix for null values in foreign keys. Thanks Andreas.

git-svn-id: http://code.djangoproject.com/svn/django/branches/new-admin@866 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Robert Wittams 2005-10-14 20:00:17 +00:00
parent a122c04d47
commit e15c4832f5

View File

@ -656,13 +656,10 @@ class ForeignKey(Field):
return [formfields.IntegerField]
def get_db_prep_save(self,value):
try:
if value == '' or None:
return None
else:
return int(value)
except Exception, e:
print "name: %s val: %s" % (self.name, value)
if value == '' or value == None:
return None
else:
return int(value)
def flatten_data(self, obj = None):
if not obj:
@ -949,4 +946,4 @@ class Admin:
new_fieldset_list.append(FieldSet(name, classes, opts.get_field, line_specs) )
return new_fieldset_list