On Jul 11, 4:23 pm, derek <gamesb...@gmail.com> wrote:
> On Jul 10, 4:40 pm, Rolando Espinoza La Fuente <dark...@gmail.com>
> wrote:
>
>
>
> > On Sat, Jul 10, 2010 at 9:31 AM, Derek <gamesb...@gmail.com> wrote:
> > > Running Django 1.2.1 under Python 2.6.
> > > I am obviously missing something cruccial, but I am just not sure where 
> > > this
> > > is...
> > > I have a setup which includes a number of many-to-many models in a legacy
> > > database.  For example:
>
> > > class Grouping(models.Model):
> > >     id = models.AutoField(primary_key=True, db_column='GroupingID')
> > >     name = models.CharField(max_length=250, db_column='GroupingName',
> > > unique=True)
> > > class TaxAgreement(models.Model):
> > >     id = models.AutoField(primary_key=True, db_column='TaxID')
> > >     title = models.CharField(max_length=100, db_column='TaxTitle',
> > > unique=True)
> > >     groupings = models.ManyToManyField(Grouping,
> > > db_table='taxagreementgrouping')
>
> > Use through 
> > keywordhttp://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.mod...
>
> > groupings = models.ManyToManyField(Grouping, through='TaxAgreementGrouping')
>
> Thanks, this fixes those problems.  Unfortunately, however, it also
> introduces a new error. When I try and start the app,  I now get:
>
> ImproperlyConfigured at /admin/
> 'TaxAgreementAdmin.fieldsets[6][1]['fields']' can't include the
> ManyToManyField field 'groupings' because 'groupings' manually
> specifies a 'through' model.
>
> I need to be able to use the "many to many" box in order to create the
> associations...
>

As a follow-up, I see from the docs that the many to many widget
_cannot_ be used in a case where "through" is specified, because the
assumption is that extra fields will be added to the join model.  This
is _not_ the case for me, so this implies I should not have to use the
"through" option to solve my original problem.

[Sidebar:  Interestingly, it has been suggested that it _could_, in
future, be possible to do this...  (see
http://www.mail-archive.com/django-upda...@googlegroups.com/msg45249.html):

"The fancy solution would be to loosen this condition slightly and
allow an m2m field to be in the fields list (and therefore allow an
m2m widget be used) *iff* the through model is just 2 foreign keys
with a unique_together pairing (i.e., if the through model is exactly
the same as the m2m model that is be automatically generated for the
non-explicit through case)."]






-- 
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