本文整理汇总了Python中corehq.apps.domain.models.LICENSES.items方法的典型用法代码示例。如果您正苦于以下问题:Python LICENSES.items方法的具体用法?Python LICENSES.items怎么用?Python LICENSES.items使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corehq.apps.domain.models.LICENSES
的用法示例。
在下文中一共展示了LICENSES.items方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: manage_multimedia
# 需要导入模块: from corehq.apps.domain.models import LICENSES [as 别名]
# 或者: from corehq.apps.domain.models.LICENSES import items [as 别名]
def manage_multimedia(request, domain):
media = request.project.all_media()
if request.method == "POST":
for m_file in media:
if '%s_tags' % m_file._id in request.POST:
m_file.tags[domain] = request.POST.get('%s_tags' % m_file._id, '').split(' ')
if domain not in m_file.shared_by and request.POST.get('%s_shared' % m_file._id, False):
m_file.shared_by.append(domain)
elif domain in m_file.shared_by and not request.POST.get('%s_shared' % m_file._id, False):
m_file.shared_by.remove(domain)
if '%s_license' % m_file._id in request.POST:
m_file.update_or_add_license(domain, type=request.POST.get('%s_license' % m_file._id, 'public'))
m_file.save()
messages.success(request, "Multimedia updated successfully!")
return render(request, 'domain/admin/media_manager.html', {'domain': domain,
'media': [{
'license': m.license.type if m.license else 'public',
'shared': domain in m.shared_by,
'url': m.url(),
'm_id': m._id,
'tags': m.tags.get(domain, []),
'type': m.doc_type
} for m in media],
'licenses': LICENSES.items()
})
示例2: options
# 需要导入模块: from corehq.apps.domain.models import LICENSES [as 别名]
# 或者: from corehq.apps.domain.models.LICENSES import items [as 别名]
def options(self):
return [(code, license_name) for code, license_name in LICENSES.items()]
示例3: update_params
# 需要导入模块: from corehq.apps.domain.models import LICENSES [as 别名]
# 或者: from corehq.apps.domain.models.LICENSES import items [as 别名]
def update_params(self):
available_licenses = [{'val': code, 'text': license} for code, license in LICENSES.items()]
self.selected = self.request.GET.get(self.slug,'')
self.options = available_licenses
示例4: page_context
# 需要导入模块: from corehq.apps.domain.models import LICENSES [as 别名]
# 或者: from corehq.apps.domain.models.LICENSES import items [as 别名]
def page_context(self):
return {
'media': self.project_media_data,
'licenses': list(LICENSES.items()),
}
示例5: update_params
# 需要导入模块: from corehq.apps.domain.models import LICENSES [as 别名]
# 或者: from corehq.apps.domain.models.LICENSES import items [as 别名]
def update_params(self):
available_licenses = [{"val": code, "text": license} for code, license in LICENSES.items()]
self.selected = self.request.GET.get(self.slug, "")
self.options = available_licenses