Request whith Q() object
There is code and Tracebeck. What I'm doing wrong?
media=MediaObject.objects.get(
Q(on_air__range=(strt_time,end_time)),
Q(channel=3),
Q(name__icontains="qwwwwwww".decode('utf-8')|Q(name__icontains="cccccccc dddddd".decode('utf-8')))
)
Traceback (most recent call last):
File "C:\Documents and Settings\POLINOM\web\website\manage.py", line 16, in <module>
execute_manager(settings)
File "C:\Python26\lib\site-packages\django\core\management\__init__.py", line 362, in execute_manager
utility.execute()
File "C:\Python26\lib\site-packages\django\core\management\__init__.py", line 303, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python26\lib\site-packages\django\core\management\base.py", line 195, in run_from_argv
self.execute(*args, **options.__dict__)
File "C:\Python26\lib\site-packages\django\core\management\base.py", line 222, in execute
output = self.handle(*args, **options)
File "C:\Documents and Settings\POLINOM\web\website\video\remmedia\management\commands\pull.py", line 38, in handle
self.FirstTimeLoad()
File "C:\Documents and Settings\POLINOM\web\website\video\remmedia\management\comman开发者_C百科ds\pull.py", line 74, in FirstTimeLoad
Q(name__icontains="╨Ь╨░╨╗╨░╤Е╨╛╨▓".decode('utf-8')|Q(name__icontains="╨Ф╨░╨▓╨░╨╣ ╨┐╨╛╨╢╨╡╨╜╨╕╨╝╤Б╤П".decode('utf-8')))
TypeError: unsupported operand type(s) for |: 'unicode' and 'Q'
You are just missing a right parenthesis:
Q(name__icontains="Малахов".decode('utf-8'))|Q(name__icontains="Давай поженимся".decode('utf-8'))
# here ---^
精彩评论