If I had the following related models:
class User(models.Model):
...
class Identity(models.Model):
user = models.ForeignKey(User, on_delete=models.PROTECT)
category = models.CharField(max_length=8, choices=IDENTITY_CATEGORIES)
...
How could I query for users with multiple email identities, where multiple Identity
instances exist of category "email" which point to the same User
.
I've seen that Django 1.8 introduced Conditional Expressions, but I'm not sure how they would apply to this situation.