Yesterday I was writing a part of a test application that I'm developing using Django and I get an extrange result.
I have a pair of models related by foreign key fields in the way I show under: class Galery(models.Model): ... class Profesional(models.Model): ... models.ForeignKey(Galery, null = True, blank = True) class UserProfesional(models.Model) models.ForeignKey(User) models.ForeignKey(Profesional) The last model makes a correspondence between a django user and one of the profesionals. Well, I was trying to delete one Galery using a generic view, I needed to write a generic view wrapper because I must check that the gallery is owned by the profesional who has init the session on the system. In my first attempt when I deleted the galery using the generic view it deleted also the profesional and the UserProfesional. I could understand this if the relation where from gallery to profesional, but not in that way. After that, I searched at this mailing group and I found people experimenting a similar problem. Well at last I knew what was the problem and I tryed to solve this in the wrapper. Before calling the generic view and as I have the profesional related with the gallery I just set profesional.gallery = None and then profesional.save() Doing this when I use the generic view it doesn't delete the profesional but it deletes UserProfesional Entry. At this point I understand that there mustn`t be any relation between the gallery and the UserProfesional. After all I just write a view that checks if the profesional is related with the gallery he wants to delete then I set profesional.gallery = None and after that I make gallery.delete(). It worked. It makes sense for anybody?, have anybody experimented something similar? In my own defense I want to say that it happened late at night and it could be a bad dream ;) Thanks in advance and my best wishes to Django developers you are making my dreams and needs true ;) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---