My boss, created a model that represents an override to parts of other model instances; the business logic demands that the model instances should be uniquely defined by two attributes a and b
ie o1.a==o2.a and o1.b==o2.b <==> o1 is o2. I know that we can implement validation rules in the admin to ensure that this is so, but he prefers to merge an existing instance into the new version at save time and also delete the existing one. Is that in fact possible with django's orm? I'm thinking of code somewhat like this def save(self): P=list(Over.objects.exclude(id=self.id). filter(a=self.a,b=self.b).order_by('id')) if P: for p in P: self.merge(p) p.delete() super(Over, self).save() would this work? -- Robin Becker --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---