Foreing Key field going null in INSERT sql when use inlineformset

10 views
Skip to first unread message

Fellipe Henrique

unread,
Jan 25, 2013, 6:53:39 AM1/25/13
to django...@googlegroups.com
I have this models:


class Pedido(models.Model):
    idvenda_pedido = models.IntegerField(verbose_name=u"Código", primary_key=True, null=False)
    num_nota = models.IntegerField(verbose_name=u'Nº Nota', blank=True, null=True)

class ItensPedido(models.Model):
    idvenda_pedido_itens = models.IntegerField(u'Código', primary_key=True, null=False, default=-1)
    idvenda_pedido = models.ForeignKey('Pedido', db_column='idvenda_pedido', null=False, blank=False)
    qnt = models.IntegerField(verbose_name=u'Quantidade', null=False, blank=False, default=1)


When I save ItensPedido, the idvenda_pedido is null. How Can I pass the idvenda_pedido field? I try to pass the integer but django tell me it`s need a "pedido" not integer value.


Thanks.
    
T.·.F.·.A.·.     S+F
Fellipe Henrique P. Soares

"Quemadmodum gladius neminem occidit, occidentis telum est." (Epistulae morales ad Lucilium, Lucius Annaeus Seneca)

"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." 
Albert Einstein (March 14th 1879 – April 18th 1955)

Anderson

unread,
Jan 25, 2013, 9:45:00 AM1/25/13
to django...@googlegroups.com
Hi Felipe
try autoField is auto increment.


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



--
Anderson Dias Borges
Senior Analyst Developer

Tu cumprirás o desejo do meu coração se eu Te buscar...
I can't see but I'll take my chances
To hear You call my name

Fellipe Henrique

unread,
Jan 25, 2013, 10:32:46 AM1/25/13
to django...@googlegroups.com
I can't use AutoField, because I need to use my StoreProcedure. I use this StoreProcedure in my Delphi application.



T.·.F.·.A.·.     S+F
Fellipe Henrique P. Soares

"Quemadmodum gladius neminem occidit, occidentis telum est." (Epistulae morales ad Lucilium, Lucius Annaeus Seneca)

"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." 
Albert Einstein (March 14th 1879 – April 18th 1955)


2013/1/25 Anderson <anderso...@gmail.com>
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages