fix findDocuments by id
This commit is contained in:
parent
b03e86f78c
commit
dada4cbf4c
1 changed files with 3 additions and 11 deletions
|
@ -2,6 +2,7 @@
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
from django.db.models import Q, Manager
|
from django.db.models import Q, Manager
|
||||||
|
|
||||||
|
import ox
|
||||||
from ox.django.query import QuerySet
|
from ox.django.query import QuerySet
|
||||||
|
|
||||||
def parseCondition(condition, user, item=None):
|
def parseCondition(condition, user, item=None):
|
||||||
|
@ -29,17 +30,8 @@ def parseCondition(condition, user, item=None):
|
||||||
else:
|
else:
|
||||||
exclude = False
|
exclude = False
|
||||||
if k == 'id':
|
if k == 'id':
|
||||||
try:
|
v = ox.fromAZ(v)
|
||||||
public_id = v.split(':')
|
return Q(**{k: v})
|
||||||
username = public_id[0]
|
|
||||||
name = ":".join(public_id[1:])
|
|
||||||
extension = name.split('.')
|
|
||||||
name = '.'.join(extension[:-1])
|
|
||||||
extension = extension[-1].lower()
|
|
||||||
q = Q(user__username=username, name=name, extension=extension)
|
|
||||||
except:
|
|
||||||
q = Q(id__in=[])
|
|
||||||
return q
|
|
||||||
if isinstance(v, bool): #featured and public flag
|
if isinstance(v, bool): #featured and public flag
|
||||||
key = k
|
key = k
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue