Is there a way to specify a constraint on a model ManyToMany
relationship?

For example, if I wanted to define an Animal model that has a field
which specifies which other animals it eats and I wanted to limited
these animals_I_eat relationships to animals who's specie_name starts
with "x", how would I do this?

E.g.

class Animal(models.Model):
    specie_name = models.CharField(max_length=50)
    animals_I_eat = models.ManyToManyField('self',blank=True)
#where animals_I_eat.specie_name starts with "x"

This is probably a very bad example, but I hope you get what I'm
trying to say

Thanks,
Alex
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to