I'm trying to fetch users list based on their language(from ArrayField). A single user can have multiple languages. When i passed single language {'Hindi'}
, it fetches all the records except user with multiple languages, but if passed parameters {'Hindi','bangla','kannada'}
then it gives me a specific record,how can i fetch the users list with hindi
and other than hindi
as well . I have tried with .all
also but it didn't worked for me. Any help would be appreciated.
# DESCRIPTION: This function gets the drivers list by lang.
@classmethod
def get_driver_by_lang(cls, driver_lang):
try:
driver_details = cls.objects.filter(language = driver_lang)
data = serializers.serialize("json", driver_details)
data = json.loads(data)
return data
except :
return False
这个怎么样:
driver_details = cls.objects.filter(language__contains = driver_lang)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.