Hi. If I have a couple of models like these:

class Poll(models.Model):
    question = models.CharField(max_length=200, unique = True)
    pub_date = models.DateTimeField('date published')

class Choice(models.Model):
    poll = models.ForeignKey(Poll)
    choice = models.CharField(max_length=200)
    votes = models.IntegerField()

and in admin.py I put "save_as=True" and I try to save a poll as a new
one, but I forget to change the question, since I want that to be
unique, I get an error as it supposed to be, but if I change the
question and try to save the poll I get this error:
invalid literal for int() with base 10: ''
and as I read on the error page I noted this:

choice_set-1-choice  u'3'
_save u'Gravar'
choice_set-0-choice u'2'
choice_set-1-votes u'0'
choice_set-1-id         u''
question        u'Idade'
choice_set-0-poll u''
choice_set-INITIAL_FORMS u'3'
choice_set-2-choice     u'1'
pub_date_1 u'12:40:48'
pub_date_0 u'2010-02-10'
choice_set-2-votes u'0'
choice_set-2-poll u''
choice_set-0-votes u'0'
choice_set-2-id         u''
choice_set-0-id         u''
choice_set-1-poll u''
choice_set-TOTAL_FORMS u'6'

The foreign key and the id's are missing.
Did someone else had this error? Is it a django bug? Am I doing
something wrong? I've searched google but I couldn't find anything
that could help me.

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to