On Fri, 2009-04-24 at 15:32 -0300, Rubens Altimari wrote: > Hello, > > > Sorry if this is a known issue, but I didn't find anything elsewhere. > > > I have these two models related by a many-to-many relationship. I'm > using the 'default' admin application to edit data, and in order to be > able to edit both sides of the relationship, I'm using the snippet > provided by powerfox at http://www.djangosnippets.org/snippets/1295/ > (I've seen there is a ticket to implement that in Django itself > eventually: http://code.djangoproject.com/ticket/897) - that is the > purpose of the 'BidirectionalField' class definition that can be seen > below. > > > class A(models.Model): > B_elements = models.ManyToManyField('B', blank=True, null=True) > <other stuff> > > > class BidirectionalField(models.ManyToManyField): > def __init__(self, *args, **kwargs): > super(BidirectionalField, self).__init__(*args, **kwargs) > self.creates_table = False
BY the way, this has been discussed in the past and is really the wrong way to skin the cat. It's not a data modelling problem at all, so implementing a model field to do this is slightly backwards. A sensible approach is to customised the form being displayed and then customising saving on that form, etc. This is *purely* a form issue. Regards, Malcolm > --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---