本文整理匯總了Python中server.models.shift.Shift.joinData方法的典型用法代碼示例。如果您正苦於以下問題:Python Shift.joinData方法的具體用法?Python Shift.joinData怎麽用?Python Shift.joinData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類server.models.shift.Shift
的用法示例。
在下文中一共展示了Shift.joinData方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: shifts
# 需要導入模塊: from server.models.shift import Shift [as 別名]
# 或者: from server.models.shift.Shift import joinData [as 別名]
def shifts(self, start=None, end=None, limit=25, filter=False, query=None):
from server.models.shift import Shift
db = core.connect("shiftspace/shared")
if not filter:
if not start:
start = [self.id]
if not end:
end = [self.id, {}]
results = Shift.by_user_and_created(db, limit=limit)
return Shift.joinData(core.objects(results[start:end]))
else:
lucene = core.lucene()
queryString = "createdBy:%s" % self.id
theFilter = core.dictToQuery(query)
if theFilter:
queryString = queryString + " AND " + theFilter
try:
print ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
print queryString
rows = lucene.search(db, "shifts", q=queryString, include_docs=True, sort="\modified")
except Exception, err:
print err
return []
shifts = [row["doc"] for row in rows]
return Shift.joinData(shifts, self.id)
示例2: unfavorite
# 需要導入模塊: from server.models.shift import Shift [as 別名]
# 或者: from server.models.shift.Shift import joinData [as 別名]
def unfavorite(self, aShift):
from server.models.favorite import Favorite
from server.models.shift import Shift
Favorite.readByUserAndShift(self.id, aShift.id).delete()
return Shift.joinData(Shift.read(aShift.id), self.id)
示例3: favorite
# 需要導入模塊: from server.models.shift import Shift [as 別名]
# 或者: from server.models.shift.Shift import joinData [as 別名]
def favorite(self, aShift):
from server.models.favorite import Favorite
from server.models.shift import Shift
Favorite.create(self.id, aShift.id)
return Shift.joinData(Shift.read(aShift.id), self.id)