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:
parent
a122c04d47
commit
e15c4832f5
@ -656,13 +656,10 @@ class ForeignKey(Field):
|
|||||||
return [formfields.IntegerField]
|
return [formfields.IntegerField]
|
||||||
|
|
||||||
def get_db_prep_save(self,value):
|
def get_db_prep_save(self,value):
|
||||||
try:
|
if value == '' or value == None:
|
||||||
if value == '' or None:
|
return None
|
||||||
return None
|
else:
|
||||||
else:
|
return int(value)
|
||||||
return int(value)
|
|
||||||
except Exception, e:
|
|
||||||
print "name: %s val: %s" % (self.name, value)
|
|
||||||
|
|
||||||
def flatten_data(self, obj = None):
|
def flatten_data(self, obj = None):
|
||||||
if not obj:
|
if not obj:
|
||||||
@ -949,4 +946,4 @@ class Admin:
|
|||||||
new_fieldset_list.append(FieldSet(name, classes, opts.get_field, line_specs) )
|
new_fieldset_list.append(FieldSet(name, classes, opts.get_field, line_specs) )
|
||||||
return new_fieldset_list
|
return new_fieldset_list
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user