我需要通过名或姓搜索用户表过滤。 给定用户John Doe Smith,其中John是First Name,Doe Smith是Last Name。 当我搜索约翰史密斯时,它应该找到上面的用户。 我知道它只是贯彻this SO answer解决的问题,但如何我这样做,在django-filter,并保持其他筛选字段像email或phone也? patient.py(只有相关的部分) class P
我已经两个模型这样定义: class House(models.Model):
# all the fields here
def capacity(self):
capacity = 0
for room in self.rooms.all():
capacity += room.capacity
return capaci