本文整理汇总了Python中mkt.developers.forms.NewPackagedAppForm类的典型用法代码示例。如果您正苦于以下问题:Python NewPackagedAppForm类的具体用法?Python NewPackagedAppForm怎么用?Python NewPackagedAppForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NewPackagedAppForm类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _upload
def _upload(request, addon=None, is_standalone=False):
user = request.user
# If there is no user, default to None (saves the file upload as anon).
form = NewPackagedAppForm(request.POST, request.FILES, user=user if user.is_authenticated() else None, addon=addon)
if form.is_valid():
validator.delay(form.file_upload.pk)
if addon:
return redirect("mkt.developers.upload_detail_for_addon", addon.app_slug, form.file_upload.pk)
elif is_standalone:
return redirect("mkt.developers.standalone_upload_detail", "packaged", form.file_upload.pk)
else:
return redirect("mkt.developers.upload_detail", form.file_upload.pk, "json")
示例2: _upload
def _upload(request, addon=None, is_standalone=False):
# If there is no user, default to None (saves the file upload as anon).
form = NewPackagedAppForm(request.POST, request.FILES, user=getattr(request, "amo_user", None), addon=addon)
if form.is_valid():
tasks.validator.delay(form.file_upload.pk)
if addon:
return redirect("mkt.developers.upload_detail_for_addon", addon.app_slug, form.file_upload.pk)
elif is_standalone:
return redirect("mkt.developers.standalone_upload_detail", "packaged", form.file_upload.pk)
else:
return redirect("mkt.developers.upload_detail", form.file_upload.pk, "json")
示例3: _upload
def _upload(request, addon_slug=None, is_standalone=False):
# If there is no user, default to None (saves the file upload as anon).
form = NewPackagedAppForm(request.POST, request.FILES,
user=getattr(request, 'amo_user', None))
if form.is_valid():
tasks.validator.delay(form.file_upload.pk)
if addon_slug:
return redirect('mkt.developers.upload_detail_for_addon',
addon_slug, form.file_upload.pk)
elif is_standalone:
return redirect('mkt.developers.standalone_upload_detail',
'packaged', form.file_upload.pk)
else:
return redirect('mkt.developers.upload_detail',
form.file_upload.pk, 'json')