problem with inlineformset_factory

48 views
Skip to first unread message

Petry

unread,
Nov 4, 2008, 1:02:18 PM11/4/08
to Django users
Hi all,

I'm having a weird problem when using inlineformset_factory, he can
only register up to 2 records, after that causes a validation error

"(Hidden field id) User phone with this None already exists."

Here is my forms [1], models [2] and views [3]

[1] http://dpaste.com/88598/
[2] http://dpaste.com/88599/
[3] http://dpaste.com/88600/

--

Marcos Daniel Petry
http://mdpetry.net

Petry

unread,
Nov 7, 2008, 9:01:57 AM11/7/08
to Django users
anyone?

On 4 nov, 16:02, Petry <marcospe...@gmail.com> wrote:
> Hi all,
>
> I'm having a weird problem when usinginlineformset_factory, he can

Daniel Roseman

unread,
Nov 7, 2008, 9:10:10 AM11/7/08
to Django users
The problem isn't anything to do with inline forms, it's this in your
model:
user = models.ForeignKey(User
,blank=True
,unique=True)
What you are saying here is that you can only have each value for user
once in the whole table - and that includes the value 'None', ie only
one ShipSalesUser can have an empty user field.

You might want to try OneToOneField there instead and drop the
unique=True.
--
DR.

Karen Tracey

unread,
Nov 7, 2008, 9:30:34 AM11/7/08
to django...@googlegroups.com

I have not looked at the original problem in any detail, but the failure to allow multiple NULL values when unique=True is set for the field was a Django bug that has been fixed, see:

http://code.djangoproject.com/ticket/9039

So, if this is the cause of the problem, using the 1.0.X branch or current trunk code instead of 1.0 should fix it.

Karen

Petry

unread,
Nov 7, 2008, 10:24:40 AM11/7/08
to Django users
I changed my template model to use OneToOneField and remove the
Blank=True, but the same error appears...

Petry

unread,
Nov 8, 2008, 8:56:06 AM11/8/08
to Django users
somebody can help me?

On 7 nov, 13:24, Petry <marcospe...@gmail.com> wrote:
> I changed my template model to use OneToOneField and remove the
> Blank=True, but the same error appears...
>
> On 7 nov, 12:30, "Karen Tracey" <kmtra...@gmail.com> wrote:
>
> > On Fri, Nov 7, 2008 at 9:10 AM, Daniel Roseman <
>
> > roseman.dan...@googlemail.com> wrote:
>
> > > On Nov 4, 6:02 pm,Petry<marcospe...@gmail.com> wrote:
> > > > Hi all,
>
> > > > I'm having a weird problem when usinginlineformset_factory, he can
> > > > only register up to 2 records, after that causes a validation error
>
> > > > "(Hidden field id) User phone with this None already exists."
>
> > > > Here is my forms [1], models [2] and views [3]
>
> > > > [1]http://dpaste.com/88598/
> > > > [2]http://dpaste.com/88599/
> > > > [3]http://dpaste.com/88600/
>
> > > > --
>
> > > > Marcos DanielPetryhttp://mdpetry.net

Karen Tracey

unread,
Nov 8, 2008, 9:02:36 AM11/8/08
to django...@googlegroups.com
On Sat, Nov 8, 2008 at 8:56 AM, Petry <marco...@gmail.com> wrote:

somebody can help me?

I didn't recommend changing your code, I recommending trying with current SVN level of the 1.0.X branch or trunk, in order to ensure you have a fix that might be relevant (I still have not had time to look in detail at your particular models/forms/etc so I'm not completely sure that is what you are hitting, but it sounds likely based on Daniel Roseman's comments).  You do not mention if you have tried your code on current SVN, not 1.0 Django?

Karen
 

Petry

unread,
Nov 8, 2008, 10:51:38 AM11/8/08
to Django users
Hi Karen!

I use the version of SVN, I am currently with version 1.1 pre-
alpha-9335 SVN


and the error still remains!




On 8 nov, 12:02, "Karen Tracey" <kmtra...@gmail.com> wrote:

boardman

unread,
Nov 24, 2008, 8:23:08 PM11/24/08
to Django users
As noted in a duplicate post over on django-devs this problem is not
evident when using the sqlite backend. The problem seems to be
limited to the postgres backend and is cuurently still failing for me
on trunk at revision 9526.

Roger.

Yanik

unread,
Nov 27, 2008, 3:14:20 PM11/27/08
to Django users
I'm using MySQL and running 1.0.2 and the bug is still there.

This ticket:
http://code.djangoproject.com/ticket/9039

is closed, but the code still hasn't been fixed and the mentioned
patch doesn't seem to work.

Has anyone gotten this to work?

Karen Tracey

unread,
Nov 27, 2008, 11:05:54 PM11/27/08
to django...@googlegroups.com
On Thu, Nov 27, 2008 at 3:14 PM, Yanik <yanik...@gmail.com> wrote:

I'm using MySQL and running 1.0.2 and the bug is still there.

This ticket:
is closed, but the code still hasn't been fixed and the mentioned
patch doesn't seem to work.

Has anyone gotten this to work?

Has anyone gotten what to work?  The referenced ticket is fixed, it may or may not have had any bearing on the original problem posted.  I mentioned it back then because I did not have time just then to devote to looking into the original problem and based on what someone else who responded said it sounded like the problem in that ticket could be the cause of the problem reported in this thread.  I have just cut-and-pasted the original models, views, and forms and using current trunk code and MySQL I cannot see any problem adding multiple (up to 4, the limit of the form) phone numbers to a user. So I don't know what bug you are talking about when you say the bug is not fixed. 

Karen
Reply all
Reply to author
Forward
0 new messages