本文整理匯總了Python中corehq.apps.commtrack.models.CommTrackUser.get方法的典型用法代碼示例。如果您正苦於以下問題:Python CommTrackUser.get方法的具體用法?Python CommTrackUser.get怎麽用?Python CommTrackUser.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類corehq.apps.commtrack.models.CommTrackUser
的用法示例。
在下文中一共展示了CommTrackUser.get方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _get_location
# 需要導入模塊: from corehq.apps.commtrack.models import CommTrackUser [as 別名]
# 或者: from corehq.apps.commtrack.models.CommTrackUser import get [as 別名]
def _get_location(form):
if 'location_id' in form.form:
loc_id = form.form['location_id']
loc = Location.get(loc_id)
else:
user_id = form['auth_context']['user_id']
user = CommTrackUser.get(user_id)
loc = user.location
return loc
示例2: owner
# 需要導入模塊: from corehq.apps.commtrack.models import CommTrackUser [as 別名]
# 或者: from corehq.apps.commtrack.models.CommTrackUser import get [as 別名]
def owner(self):
if self.owner_doc_type == "CommCareCase":
# Circular import
from corehq.apps.sms.models import CommConnectCase
return CommConnectCase.get(self.owner_id)
elif self.owner_doc_type == "CommCareUser":
# Circular import
from corehq.apps.users.models import CommCareUser
return CommCareUser.get(self.owner_id)
elif self.owner_doc_type == "CommTrackUser":
# Circular import
from corehq.apps.commtrack.models import CommTrackUser
return CommTrackUser.get(self.owner_id)
elif self.owner_doc_type == 'WebUser':
# Circular importsms
from corehq.apps.users.models import WebUser
return WebUser.get(self.owner_id)
else:
return None
示例3: _get_location
# 需要導入模塊: from corehq.apps.commtrack.models import CommTrackUser [as 別名]
# 或者: from corehq.apps.commtrack.models.CommTrackUser import get [as 別名]
def _get_location(form):
loc = None
if 'location_id' in form.form:
loc_id = form.form['location_id']
try:
loc = Location.get(loc_id)
except ResourceNotFound:
logging.info('Location %s Not Found.' % loc_id)
else:
user_id = form['auth_context']['user_id']
if not user_id:
return None
user = CommTrackUser.get(user_id)
try:
loc = user.location
except ResourceNotFound:
logging.info('Location %s Not Found.' % loc)
return loc