How do I prevent a ManyToManyField('self') from linked an object to itself?
- by dyve
Consider this model (simplified for this question):
class SecretAgentName(models.Model):
name = models.CharField(max_length=100)
aliases = ManyToManyField('self')
I have three names, "James Bond", "007" and "Jason Bourne". "James Bond" and "007" are aliases of each other.
This works exactly like I want it to, except for the fact that…