本文整理汇总了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