use subquery for not in list
This commit is contained in:
parent
9b76d89cfa
commit
a0d7ba2ab5
1 changed files with 2 additions and 1 deletions
|
@ -4,6 +4,7 @@
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import unicodedata
|
import unicodedata
|
||||||
from sqlalchemy.sql import operators
|
from sqlalchemy.sql import operators
|
||||||
|
from sqlalchemy.orm import load_only
|
||||||
|
|
||||||
import utils
|
import utils
|
||||||
import settings
|
import settings
|
||||||
|
@ -121,7 +122,7 @@ class Parser(object):
|
||||||
u = self._user.query.filter_by(id=settings.USER_ID).one()
|
u = self._user.query.filter_by(id=settings.USER_ID).one()
|
||||||
l = self._list.query.filter_by(user_id=u.id, name=name).one()
|
l = self._list.query.filter_by(user_id=u.id, name=name).one()
|
||||||
if exclude:
|
if exclude:
|
||||||
ids = [i.id for i in l.get_items()]
|
ids = l.user.items.filter(self._list.id==l.id).options(load_only('id'))
|
||||||
q = operators.notin_op(self._model.id, ids)
|
q = operators.notin_op(self._model.id, ids)
|
||||||
else:
|
else:
|
||||||
if l.type == 'smart':
|
if l.type == 'smart':
|
||||||
|
|
Loading…
Reference in a new issue