On Sat, Apr 25, 2009 at 2:32 AM, Rubens Altimari <rub...@altimari.com.br> 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 > class B(models.Model): > A_elements = BidirectionalField('A', db_table='myapp_A_Bs', blank=True) > <other stuff> > And everything works fine, as far as I can see. My client swears, though, > that every now and then (quite frequently), when doing some editing in model > A (at the other fields), it will eventually 'loose' the established > relationships with model B. So he has to establish them again, that is, pick > the values from B in the listbox, move them to the right listbox, and save, > etc. > For the life of me, I just can't reproduce this error, so it is not > confirmed. But my client is 100% sure it does happen, and not by some > mistake of his part. Of course, this is yet to be verified, but does this > problem sound familiar to anyone?
Unfortunately for your client, I'm on your side here. This sort of problem doesn't sound particularly familiar to me, and it doesn't sound particularly likely, either. M2M fields are pretty well established, and haven't gone through any major changes for some time. The only thought I have is that you appear to be using a pre-existing table to manage the m2m relationship, rather than the default produced Django table. This shouldn't pose a problem, but it does lead me to wonder if there is some other process that could be using that table. It also makes me want to confirm that the m2m table in question is defined in a way that is compatible with a normal m2m Django table. Other than that - this has all the hallmarks of a user error. Are you in a position to 'sit on your client's shoulder' until the problem reproduces itself? Yours, Russ Magee %-) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---