Re: In admin, unable to save many-to-many relation objects with intermidiate table

2008-07-09 Thread Rob Hudson

I just bumped into this last night and found that having core on the
ForeignKey field cause it to not save the record.  Try removing
core=True and see if that helps.

-Rob

On Jul 8, 6:02 pm, "ristretto.rb" <[EMAIL PROTECTED]> wrote:
> Hello, I'm stuck.  Any help will be much appreciated.
>
> I 
> followedhttp://www.djangoproject.com/documentation/models/m2m_intermediary/to
> make a
> Many-to-many relationship via an intermediary table.
>
> class LeftSide(models.Model):
> :
>
> class RightSide(models.Model):
> :
>
> class JoinTable(models.Model):
>     leftSide = models.ForeignKey(LeftSide,
>                 edit_inline=models.TABULAR,
>                 num_in_admin=3, core=True)
>     rightSide = models.ForeignKey(RightSide,
>                 edit_inline=models.TABULAR,
>                 num_in_admin=3,core=True)
>     reference_no = models.CharField(max_length=10, null=True, blank=True)
>
> I can load the LeftSide in the admin, and choose to Change a record.  I
> get 3 RightSide menu groups at the bottom.  I can choose a RightSide to
> set as a join.  When I choose Save (any of the 3 save variations on the
> page) nothing is saved.
>
> There are two cases.
>
> 1)  If the are already records in the join table for that LeftSide, then
> I get an error when I save.  {'jointable.0.id': [u'Join Table record
> with this ID already exists.']}  I didn't actually make any changes to
> that association, so I don't know why it would complain.
>
> 2)  If there are no join table records associated with the LeftSide,
> then there is no error, but nothing is saved, either.
>
> Am I doing something totally wrong here?  Or is this a bug in the Admin
> system?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



In admin, unable to save many-to-many relation objects with intermidiate table

2008-07-08 Thread ristretto.rb

Hello, I'm stuck.  Any help will be much appreciated.

I followed 
http://www.djangoproject.com/documentation/models/m2m_intermediary/ to 
make a
Many-to-many relationship via an intermediary table.

class LeftSide(models.Model):
:

class RightSide(models.Model):
:

class JoinTable(models.Model):
leftSide = models.ForeignKey(LeftSide,
edit_inline=models.TABULAR,
num_in_admin=3, core=True)
rightSide = models.ForeignKey(RightSide,
edit_inline=models.TABULAR,
num_in_admin=3,core=True)
reference_no = models.CharField(max_length=10, null=True, blank=True)

I can load the LeftSide in the admin, and choose to Change a record.  I 
get 3 RightSide menu groups at the bottom.  I can choose a RightSide to 
set as a join.  When I choose Save (any of the 3 save variations on the 
page) nothing is saved.

There are two cases. 

1)  If the are already records in the join table for that LeftSide, then 
I get an error when I save.  {'jointable.0.id': [u'Join Table record 
with this ID already exists.']}  I didn't actually make any changes to 
that association, so I don't know why it would complain.

2)  If there are no join table records associated with the LeftSide, 
then there is no error, but nothing is saved, either.

Am I doing something totally wrong here?  Or is this a bug in the Admin 
system?



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