On 2/3/11 11:22 PM, Gert Van Gool wrote:
Can you give an example of the model(s) you're talking about?

Certainly.  Simplified and stripped version:

class HostGroup(models.Model):
    hosts           = models.ManyToManyField('Host', blank=True, null=True,
                        related_name='%(class)s_hosts',
                        db_table='config_host_hostgroups')
class Host(models.Model):
hostgroup = models.ManyToManyField('HostGroup', blank=True, null=True,
                        related_name='%(class)s_hostgroups',
                        db_table='config_host_hostgroups')

I'm manipulating the data via standard admin forms, with fieldsets and filter_horizontal.

All the other options I've come across for this kind of data model don't work with fieldsets OR filter_horizontal.
On Thu, Feb 3, 2011 at 22:36, Mike Lindsey<mike-dja...@5dninja.net>  wrote:
I'm doing something with bidirectional ManyToManyFields, in a project
I'm working on, that is resulting in duplicate attempts to create the
intermediate tables.  I'm perfectly open to suggestions of "You're
doing it wrong" if they come with advice on how to fix my problem,
without losing the easy Admin insertion of the relationships (without
resorting to InLines, which don't seem to play nicely at all with
FieldSets).  Right now I'm getting around the problem by running
syncdb, running dbshell to drop the table it complains about, and
rerunning syncdb; repeating until syncdb finishes successfully.

What would make this exceptionally easy, is if there was the option to
set 'abstract=True' on second iteration of each of the
ManyToManyFields, telling syncdb to not attempt to create it.

Thoughts?

--
Mike Lindsey

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




--
--
Mike Lindsey

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

Reply via email to