I am trying to execute a search query using ManyToMany Relationships, This is what I still have:
designs = designs.filter(Q(title__icontains = search) | Q(tags__icontains = search))
Do you know how I can search the tags.title field in a query?
Here are the models, I cleaned them, so they arent so long :)
class Design(models.Model): title = models.CharField(max_length = 50, default = "") slug = models.SlugField(unique = True) user = models.ForeignKey(User, related_name = "design_user") description = models.TextField() tags = models.ManyToManyField(to = Tags) class Tags(models.Model): title = models.CharField(max_length = 50, unique = True)
Most of the questions I was looking for use filters, and I am not a Django master, so I ask this, hopefully not add a duplicate question.
Jream source share