Hey guys, I'm quite new to Django and python ;o)
My problem is the following: I have the following many to many relations ---------------------------------------- Example DB schema ---------------------------------------- class Country(models.Model): name = models.CharField(max_length=200) iso = models.CharField(max_length=3) def __unicode__(self): return self.name class Crag(models.Model): country = models.ForeignKey(Country) name = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') def __unicode__(self): return self.name class Route(models.Model): crag = models.ForeignKey(Crag) name = models.CharField(max_length=200) grade = models.CharField(max_length=3) def __unicode__(self): return self.name class Realization(models.Model): routes = models.ManyToManyField(Route) users = models.ManyToManyField(User) name = models.CharField(max_length=200) def __unicode__(self): return self.name ---------------------------------------- Namely : a Crag has many Routes (1-n) Realization hasAndBelongs to User (n-n) Realization hasAndBelongs to Route (n-n) If a User inserts a Realization (that basically is a Route solved by a User), I want to if a Route for the given Crag already exists with the same name in DB just insert it its key in the realization table else insert the route name in the Routes table insert it its key in the realization table Any idea on the best way to achieve this? - overwrite the Realization.save method - use a pre-save signal Cheers Dan --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---