Example #1
0
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")
Example #2
0
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')