本文整理汇总了Python中mkt.webapps.models.Webapp.version_and_file_transformer方法的典型用法代码示例。如果您正苦于以下问题:Python Webapp.version_and_file_transformer方法的具体用法?Python Webapp.version_and_file_transformer怎么用?Python Webapp.version_and_file_transformer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mkt.webapps.models.Webapp
的用法示例。
在下文中一共展示了Webapp.version_and_file_transformer方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: queue_apps
# 需要导入模块: from mkt.webapps.models import Webapp [as 别名]
# 或者: from mkt.webapps.models.Webapp import version_and_file_transformer [as 别名]
def queue_apps(request):
queues_helper = ReviewersQueuesHelper(request)
qs = queues_helper.get_pending_queue()
apps = queues_helper.sort(qs, date_sort='nomination')
apps = [QueuedApp(app, app.all_versions[0].nomination)
for app in Webapp.version_and_file_transformer(apps)]
return _queue(request, apps, 'pending', date_sort='nomination')
示例2: device_queue_search
# 需要导入模块: from mkt.webapps.models import Webapp [as 别名]
# 或者: from mkt.webapps.models.Webapp import version_and_file_transformer [as 别名]
def device_queue_search(request):
"""
Returns a queryset that can be used as a base for searching the device
specific queue.
"""
filters = {"type": amo.ADDON_WEBAPP, "status": amo.STATUS_PENDING, "disabled_by_user": False}
sig = request.GET.get("pro")
if sig:
profile = FeatureProfile.from_signature(sig)
filters.update(dict(**profile.to_kwargs(prefix="_current_version__features__has_")))
return Webapp.version_and_file_transformer(Webapp.objects.filter(**filters))
示例3: queue_updates
# 需要导入模块: from mkt.webapps.models import Webapp [as 别名]
# 或者: from mkt.webapps.models.Webapp import version_and_file_transformer [as 别名]
def queue_updates(request):
use_es = waffle.switch_is_active('reviewer-tools-elasticsearch')
queues_helper = ReviewersQueuesHelper(request, use_es=use_es)
apps = queues_helper.get_updates_queue()
apps = queues_helper.sort(apps, date_sort='nomination')
if not use_es:
apps = [QueuedApp(app, app.all_versions[0].nomination)
for app in Webapp.version_and_file_transformer(apps)]
return _queue(request, apps, 'updates', date_sort='nomination',
use_es=use_es)
示例4: queue_apps
# 需要导入模块: from mkt.webapps.models import Webapp [as 别名]
# 或者: from mkt.webapps.models.Webapp import version_and_file_transformer [as 别名]
def queue_apps(request):
excluded_ids = EscalationQueue.uncached.values_list('addon', flat=True)
qs = (Version.uncached.filter(addon__type=amo.ADDON_WEBAPP,
addon__disabled_by_user=False,
addon__status=amo.STATUS_PENDING)
.exclude(addon__id__in=excluded_ids)
.order_by('nomination', 'created')
.select_related('addon').no_transforms())
qs = _queue_to_apps(request, qs, date_field='nomination')
apps = [QueuedApp(app, app.all_versions[0].nomination)
for app in Webapp.version_and_file_transformer(qs)]
return _queue(request, apps, 'pending')
示例5: queue_updates
# 需要导入模块: from mkt.webapps.models import Webapp [as 别名]
# 或者: from mkt.webapps.models.Webapp import version_and_file_transformer [as 别名]
def queue_updates(request):
excluded_ids = EscalationQueue.uncached.values_list('addon', flat=True)
addon_ids = (File.objects.filter(status=amo.STATUS_PENDING,
version__addon__is_packaged=True,
version__addon__status=amo.STATUS_PUBLIC,
version__addon__type=amo.ADDON_WEBAPP,
version__addon__disabled_by_user=False)
.values_list('version__addon_id', flat=True))
qs = (Webapp.uncached.exclude(id__in=excluded_ids)
.filter(id__in=addon_ids))
apps = Webapp.version_and_file_transformer(qs)
apps = [QueuedApp(app, app.all_versions[0].all_files[0].created)
for app in qs]
apps = sorted(apps, key=lambda a: a.created)
return _queue(request, apps, 'updates')
示例6: queue_updates
# 需要导入模块: from mkt.webapps.models import Webapp [as 别名]
# 或者: from mkt.webapps.models.Webapp import version_and_file_transformer [as 别名]
def queue_updates(request):
excluded_ids = EscalationQueue.objects.no_cache().values_list('addon',
flat=True)
qs = (Version.objects.no_cache().filter(
files__status=amo.STATUS_PENDING,
addon__disabled_by_user=False,
addon__status__in=amo.WEBAPPS_APPROVED_STATUSES)
.exclude(addon__id__in=excluded_ids)
.order_by('nomination', 'created')
.select_related('addon', 'files').no_transforms())
apps = _do_sort(request, qs, date_sort='nomination')
apps = [QueuedApp(app, app.all_versions[0].nomination)
for app in Webapp.version_and_file_transformer(apps)]
return _queue(request, apps, 'updates', date_sort='nomination')
示例7: queue_updates
# 需要导入模块: from mkt.webapps.models import Webapp [as 别名]
# 或者: from mkt.webapps.models.Webapp import version_and_file_transformer [as 别名]
def queue_updates(request):
excluded_ids = EscalationQueue.uncached.values_list("addon", flat=True)
addon_ids = File.objects.filter(
status=amo.STATUS_PENDING,
version__addon__is_packaged=True,
version__addon__status=amo.STATUS_PUBLIC,
version__addon__type=amo.ADDON_WEBAPP,
version__addon__disabled_by_user=False,
).values_list("version__addon_id", flat=True)
qs = Webapp.uncached.exclude(id__in=excluded_ids).filter(id__in=addon_ids)
qs, search_form = _get_search_form(request, _do_sort(request, qs))
apps = [QueuedApp(app, app.all_versions[0].all_files[0].created) for app in Webapp.version_and_file_transformer(qs)]
apps = sorted(apps, key=lambda a: a.created)
return _queue(request, apps, "updates", search_form)
示例8: queue_apps
# 需要导入模块: from mkt.webapps.models import Webapp [as 别名]
# 或者: from mkt.webapps.models.Webapp import version_and_file_transformer [as 别名]
def queue_apps(request):
use_es = waffle.switch_is_active('reviewer-tools-elasticsearch')
sort_field = 'nomination'
queues_helper = ReviewersQueuesHelper(request, use_es=use_es)
qs = queues_helper.get_pending_queue()
qs = queues_helper.sort(qs, date_sort=sort_field)
if use_es:
apps = qs
else:
apps = [QueuedApp(app, app.all_versions[0].nomination)
for app in Webapp.version_and_file_transformer(qs)]
return _queue(request, apps, 'pending', date_sort='nomination',
use_es=use_es)
示例9: device_queue_search
# 需要导入模块: from mkt.webapps.models import Webapp [as 别名]
# 或者: from mkt.webapps.models.Webapp import version_and_file_transformer [as 别名]
def device_queue_search(request):
"""
Returns a queryset that can be used as a base for searching the device
specific queue.
"""
filters = {
'status': amo.STATUS_PENDING,
'disabled_by_user': False,
}
sig = request.GET.get('pro')
if sig:
profile = FeatureProfile.from_signature(sig)
filters.update(dict(
**profile.to_kwargs(prefix='_latest_version__features__has_')
))
return Webapp.version_and_file_transformer(
Webapp.objects.filter(**filters))
示例10: queue_homescreen
# 需要导入模块: from mkt.webapps.models import Webapp [as 别名]
# 或者: from mkt.webapps.models.Webapp import version_and_file_transformer [as 别名]
def queue_homescreen(request):
use_es = waffle.switch_is_active('reviewer-tools-elasticsearch')
sort_field = 'nomination'
queues_helper = ReviewersQueuesHelper(request, use_es=use_es)
apps = queues_helper.get_homescreen_queue()
apps = queues_helper.sort(apps, date_sort=sort_field)
if use_es:
apps = [QueuedApp(app, app.latest_version.nomination_date)
for app in apps.execute()]
else:
apps = [QueuedApp(app, app.all_versions[0].nomination)
for app in Webapp.version_and_file_transformer(apps)]
return _queue(request, apps, 'homescreen', date_sort='nomination',
use_es=use_es)
示例11: queue_updates
# 需要导入模块: from mkt.webapps.models import Webapp [as 别名]
# 或者: from mkt.webapps.models.Webapp import version_and_file_transformer [as 别名]
def queue_updates(request):
excluded_ids = EscalationQueue.objects.no_cache().values_list('addon',
flat=True)
pub_statuses = amo.WEBAPPS_APPROVED_STATUSES
addon_ids = (File.objects.filter(status=amo.STATUS_PENDING,
version__addon__is_packaged=True,
version__addon__status__in=pub_statuses,
version__addon__type=amo.ADDON_WEBAPP,
version__addon__disabled_by_user=False,
version__deleted=False)
.values_list('version__addon_id', flat=True))
apps = _do_sort(request, Webapp.objects.no_cache().exclude(
id__in=excluded_ids).filter(id__in=addon_ids))
apps = [QueuedApp(app, app.all_versions[0].nomination or app.created)
for app in Webapp.version_and_file_transformer(apps)]
apps = sorted(apps, key=lambda a: a.created)
return _queue(request, apps, 'updates')
示例12: queue_apps
# 需要导入模块: from mkt.webapps.models import Webapp [as 别名]
# 或者: from mkt.webapps.models.Webapp import version_and_file_transformer [as 别名]
def queue_apps(request):
excluded_ids = EscalationQueue.objects.no_cache().values_list('addon',
flat=True)
qs = (Version.objects.no_cache().filter(
files__status=amo.STATUS_PENDING, addon__type=amo.ADDON_WEBAPP,
addon__disabled_by_user=False,
addon__status=amo.STATUS_PENDING)
.exclude(addon__id__in=excluded_ids)
.order_by('nomination', 'created')
.select_related('addon', 'files').no_transforms())
if waffle.switch_is_active('iarc'):
qs = qs.exclude(addon__content_ratings__isnull=True)
apps = _do_sort(request, qs, date_sort='nomination')
apps = [QueuedApp(app, app.all_versions[0].nomination)
for app in Webapp.version_and_file_transformer(apps)]
return _queue(request, apps, 'pending', date_sort='nomination')