0

i have a model as bellow

class CommentOfPost(models.Model):
    comment_text = models.TextField()

comment_text data is unicode('utf-8') looklike 'سلام علیکم' and 'Хороший результат!'

some data is 'السلام علیک' and 'سلام علیکم' and 'اسلامی' and 'مرحبا سلام علیک'

i want filter looklike

CommentOfPost.objects.filter(comment_text_contains='سلام')

and result just be:

queryset<'سلام علیکم','مرحبا سلام علیک'>

not be:

queryset< 'سلام علیکم' , 'اسلامی' , 'مرحبا سلام علیک','السلام علیک' >

another word i want regex filter in unicode text

NOTE:

i try this:

comments = CommentOfPost.objects.filter(comment_text__iregex=r'\b{}\b'.format(u'سلام'))

but when i use regex or iregex not return any unicode results

hn_tired
  • 690
  • 10
  • 21

0 Answers0