A task can be assigned to multiple people. Now we want to query all the tasks assigned (assigns
) to user_id = 1
. How to write?
class Task(models.Model):
assigns = models.ManyToManyField(User, blank=True, verbose_name='指派给')
# User 是系统自带的 User 模型
How to query?
Task.object.filter(?如何查询?)
Documentation:
https://docs.djangoproject.co...
But it should also work: