Commit e9fee34e by Dr. Kashif Rasul

added keys() queryset function

keys lets you restrict the fields returned by passing in names of fields you need.
parent 692af51a
...@@ -152,6 +152,11 @@ class Queryset(object): ...@@ -152,6 +152,11 @@ class Queryset(object):
q._options['skip'] = int(value) q._options['skip'] = int(value)
return q return q
def keys(self, *fields):
q = copy.deepcopy(self)
q._options['keys'] = ','.join(fields)
return q
def order_by(self, order, descending=False): def order_by(self, order, descending=False):
q = copy.deepcopy(self) q = copy.deepcopy(self)
# add a minus sign before the order value if descending == True # add a minus sign before the order value if descending == True
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment