models.py
class Thing(models.Model):
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=256)
tags = TaggableManager(blank=True)
views.py
q = "汽车"
ob = models.Thing.objects.filter(Q(name__icontains=q)|Q(tags__name__in=[q]))
2023-12-27 13:33:39
models.py
class Thing(models.Model):
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=256)
tags = TaggableManager(blank=True)
views.py
q = "汽车"
ob = models.Thing.objects.filter(Q(name__icontains=q)|Q(tags__name__in=[q]))