Django __in lowercase

前端 未结 1 1829
不知归路
不知归路 2020-12-20 02:36

I\'m using django-taggit, which handles the attachment of tags to arbitrary content types. I imported a large tag list, which contains many uppercase words, as well as lower

相关标签:
1条回答
  • 2020-12-20 03:09

    There is no easy way to do it. I'm not 100% sure, You can try something like this for your problem.

    from django.models import Q
    
    q = Q()
    for tag in tags.split():
        q |= Q(tags__name__iexact=tag)
    
    Media.objects.filter(q)
    
    0 讨论(0)
提交回复
热议问题