Code

Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#1010 closed defect (duplicate)

rev 1560 fails to save object

Reported by: anonymous Owned by: adrian
Component: Core (Other) Version: master
Severity: critical Keywords: Revision 1560
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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.

Attachments (0)

Change History (2)

comment:1 Changed 9 years ago by anonymous

  • Component changed from Admin interface to Core framework
  • Keywords Revision 1560 added
  • Severity changed from normal to critical
  • Version set to SVN

comment:2 Changed 9 years ago by hugo

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate to #927

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.