1
我需要通過名或姓搜索用戶表過濾。使用django-filter過濾名或姓
給定用戶John Doe Smith,其中John是First Name,Doe Smith是Last Name。
當我搜索約翰史密斯時,它應該找到上面的用戶。
我知道它只是貫徹this SO answer解決的問題,但如何我這樣做,在django-filter
,並保持其他篩選字段像email
或phone
也?
patient.py
(只有相關的部分)
class Patient(TimeStampedModel):
name = models.CharField('Name', max_length=30)
last_name = models.CharField('Last Name', max_length=30)
phone = models.CharField('Phone', max_length=14)
什麼代碼你嘗試過嗎?你的模型是什麼? – wmorrell
啊,剛剛發現了FilterSet的'method'參數 –