#1010 closed defect (duplicate)
rev 1560 fails to save object
Reported by: | anonymous | Owned by: | Adrian Holovaty |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | critical | Keywords: | Revision 1560 |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Development server revision 1560.
After updating from I don't know which revision, A model that has the following fields:
ForeignKey
IntegerField
CharField
When I create a new object for the model do a save() on the object, get this:
Traceback (most recent call last):
File "do_ldap.py", line 361, in ?
Main()
File "do_ldap.py", line 358, in Main
add_update_grouptable(server_id='xxx')
File "do_ldap.py", line 328, in add_update_grouptable
add_g.save()
File "/apps/django/lib/django/utils/functional.py", line 3, in _curried
return args[0](*(args[1:]+moreargs), dict(kwargs.items() + morekwargs.items()))
File "/apps/django/lib/django/core/meta/init.py", line 1012, in method_save
db_values = [f.get_db_prep_save(f.pre_save(getattr(self, f.attname), True)) for f in opts.fields if not isinstance(f, AutoField)]
File "/apps/django/lib/django/core/meta/fields.py", line 725, in get_db_prep_save
return int(value)
ValueError: invalid literal for int(): xxx
From the source code in fields.py:
def get_db_prep_save(self,value):
if value == or value == None:
return None
else:
return int(value)
The above if a method from the ForeignKey field, I did pass the foreign key object to when creating the object. Please can this be fixed asap.
Change History (2)
comment:1 by , 19 years ago
Component: | Admin interface → Core framework |
---|---|
Keywords: | Revision 1560 added |
Severity: | normal → critical |
Version: | → SVN |
comment:2 by , 19 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Duplicate to #927