Django query if field value is one of multiple choices
- by Nathan
Say I want to model a system where a piece of data can have multiple tags (e.g. a question on a StackOverflow is the data, it's set of tags are the tags). I can model this in Django with the following:
class Tag(models.Model):
name = models.CharField(10)
class Data(models.Model):
tags = models.ManyToManyField(Tag)
Given a set of…