• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python forms.IARCGetAppInfoForm类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mkt.developers.forms.IARCGetAppInfoForm的典型用法代码示例。如果您正苦于以下问题:Python IARCGetAppInfoForm类的具体用法?Python IARCGetAppInfoForm怎么用?Python IARCGetAppInfoForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了IARCGetAppInfoForm类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: content_ratings_edit

def content_ratings_edit(request, addon_id, addon):
    initial = {}
    try:
        app_info = addon.iarc_info
        initial['submission_id'] = app_info.submission_id
        initial['security_code'] = app_info.security_code
    except IARCInfo.DoesNotExist:
        pass

    form = IARCGetAppInfoForm(data=request.POST or None, initial=initial)

    if request.method == 'POST' and form.is_valid():
        try:
            form.save(addon)
            messages.success(request, _('Content ratings successfully saved.'))
            return redirect(addon.get_dev_url('ratings'))
        except django_forms.ValidationError:
            pass  # Fall through to show the form error.

    with amo.utils.no_translation(addon.default_locale):
        addon_delocalized = Addon.objects.get(pk=addon.pk)

    return jingo.render(
        request, 'developers/apps/ratings/ratings_edit.html', {
            'addon': addon,
            'app_name': addon_delocalized.name,
            'form': form,
            'now': datetime.now().strftime('%Y-%m-%d %H:%M:%S')
        })
开发者ID:sylvesterwillis,项目名称:zamboni,代码行数:29,代码来源:views.py


示例2: content_ratings_edit

def content_ratings_edit(request, addon_id, addon):
    initial = {}
    try:
        app_info = addon.iarc_info
        initial['submission_id'] = app_info.submission_id
        initial['security_code'] = app_info.security_code
    except IARCInfo.DoesNotExist:
        pass

    form = IARCGetAppInfoForm(data=request.POST or None, initial=initial)

    if request.method == 'POST' and form.is_valid():
        try:
            form.save(addon)
            return redirect(addon.get_dev_url('ratings'))
        except django_forms.ValidationError:
            pass  # Fall through to show the form error.

    # Save some information for _ratings_success_msg.
    if not 'ratings_edit' in request.session:
        request.session['ratings_edit'] = {}
    request.session['ratings_edit'][addon.id] = {
        'app_status': addon.status,
        'rating_modified': addon.last_rated_time()
    }
    request.session.modified = True

    return jingo.render(
        request, 'developers/apps/ratings/ratings_edit.html', {
            'addon': addon,
            'app_name': get_iarc_app_title(addon),
            'form': form,
            'now': datetime.now().strftime('%Y-%m-%d %H:%M:%S')
        })
开发者ID:aricha,项目名称:zamboni,代码行数:34,代码来源:views.py


示例3: content_ratings_edit

def content_ratings_edit(request, addon_id, addon):
    initial = {}
    try:
        app_info = addon.iarc_info
        initial['submission_id'] = app_info.submission_id
        initial['security_code'] = app_info.security_code
    except IARCInfo.DoesNotExist:
        pass
    messages.debug(request,
                   "DEBUG mode on; you may use IARC id 0 with any code")
    form = IARCGetAppInfoForm(data=request.POST or None, initial=initial,
                              app=addon)

    if request.method == 'POST' and form.is_valid():
        try:
            form.save()
            return redirect(addon.get_dev_url('ratings'))
        except django_forms.ValidationError:
            pass  # Fall through to show the form error.

    # Save some information for _ratings_success_msg.
    if 'ratings_edit' not in request.session:
        request.session['ratings_edit'] = {}
    last_rated = addon.last_rated_time()
    request.session['ratings_edit'][str(addon.id)] = {
        'app_status': addon.status,
        'rating_modified': last_rated.isoformat() if last_rated else None
    }
    request.session.modified = True

    ctx = {
        'addon': addon,
        'app_name': get_iarc_app_title(addon),
        'form': form,
        'company': addon.latest_version.developer_name,
        'now': datetime.now().strftime('%Y-%m-%d %H:%M:%S')
    }

    if waffle.switch_is_active('iarc-upgrade-v2'):
        try:
            iarc_request = addon.iarc_request
            outdated = (datetime.now() - iarc_request.created >
                        timedelta(hours=1))
            if outdated:
                # IARC request outdated. Re-create.
                iarc_request.delete()
                iarc_request = IARCRequest.objects.create(
                    app=addon, uuid=uuid.uuid4())
        except IARCRequest.DoesNotExist:
            # No IARC request exists. Create.
            iarc_request = IARCRequest.objects.create(
                app=addon, uuid=uuid.uuid4())
        ctx['iarc_request_id'] = unicode(uuid.UUID(iarc_request.uuid))

    return render(request, 'developers/apps/ratings/ratings_edit.html', ctx)
开发者ID:washort,项目名称:zamboni,代码行数:55,代码来源:views.py


示例4: content_ratings

    def content_ratings(self, request, *args, **kwargs):
        app = self.get_object()
        form = IARCGetAppInfoForm(data=request.DATA, app=app)

        if form.is_valid():
            try:
                form.save(app)
                return Response(status=status.HTTP_201_CREATED)
            except django_forms.ValidationError:
                pass

        return Response(form.errors, status=status.HTTP_400_BAD_REQUEST)
开发者ID:atiqueahmedziad,项目名称:zamboni,代码行数:12,代码来源:views.py


示例5: content_ratings

    def content_ratings(self, request, *args, **kwargs):
        app = self.get_object()
        if waffle.switch_is_active('iarc-upgrade-v2'):
            form = IARCV2ExistingCertificateForm(data=request.data, app=app)
        else:
            form = IARCGetAppInfoForm(data=request.data, app=app)

        if form.is_valid():
            try:
                form.save(app)
                return Response(status=status.HTTP_201_CREATED)
            except django_forms.ValidationError:
                pass

        return Response(form.errors, status=status.HTTP_400_BAD_REQUEST)
开发者ID:Fjoerfoks,项目名称:zamboni,代码行数:15,代码来源:views.py


示例6: content_ratings_edit

def content_ratings_edit(request, addon_id, addon):
    form = IARCGetAppInfoForm(request.POST or None)

    if request.method == 'POST' and form.is_valid():
        try:
            form.save(addon)
            messages.success(request, _('Content ratings successfully saved.'))
            return redirect(addon.get_dev_url('ratings'))
        except django_forms.ValidationError:
            pass  # Fall through to show the form error.

    return jingo.render(
        request, 'developers/apps/ratings/ratings_edit.html', {
            'addon': addon,
            'form': form,
        })
开发者ID:chusiang,项目名称:zamboni,代码行数:16,代码来源:views.py


示例7: content_ratings_edit

def content_ratings_edit(request, addon_id, addon):
    initial = {}
    try:
        app_info = addon.iarc_info
        initial["submission_id"] = app_info.submission_id
        initial["security_code"] = app_info.security_code
    except IARCInfo.DoesNotExist:
        pass
    messages.debug(request, "DEBUG mode on; you may use IARC id 0 with any code")
    form = IARCGetAppInfoForm(data=request.POST or None, initial=initial, app=addon)

    if request.method == "POST" and form.is_valid():
        try:
            form.save()
            return redirect(addon.get_dev_url("ratings"))
        except django_forms.ValidationError:
            pass  # Fall through to show the form error.

    # Save some information for _ratings_success_msg.
    if "ratings_edit" not in request.session:
        request.session["ratings_edit"] = {}
    last_rated = addon.last_rated_time()
    request.session["ratings_edit"][str(addon.id)] = {
        "app_status": addon.status,
        "rating_modified": last_rated.isoformat() if last_rated else None,
    }
    request.session.modified = True

    return render(
        request,
        "developers/apps/ratings/ratings_edit.html",
        {
            "addon": addon,
            "app_name": get_iarc_app_title(addon),
            "form": form,
            "company": addon.latest_version.developer_name,
            "now": datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
        },
    )
开发者ID:ngokevin,项目名称:zamboni,代码行数:39,代码来源:views.py


示例8: content_ratings_edit

def content_ratings_edit(request, addon_id, addon):
    initial = {}
    try:
        app_info = addon.iarc_info
        initial['submission_id'] = app_info.submission_id
        initial['security_code'] = app_info.security_code
    except IARCInfo.DoesNotExist:
        pass

    form = IARCGetAppInfoForm(data=request.POST or None, initial=initial,
                              app=addon)

    if request.method == 'POST' and form.is_valid():
        try:
            form.save()
            return redirect(addon.get_dev_url('ratings'))
        except django_forms.ValidationError:
            pass  # Fall through to show the form error.

    # Save some information for _ratings_success_msg.
    if not 'ratings_edit' in request.session:
        request.session['ratings_edit'] = {}
    last_rated = addon.last_rated_time()
    request.session['ratings_edit'][addon.id] = {
        'app_status': addon.status,
        'rating_modified': last_rated.isoformat() if last_rated else None
    }
    request.session.modified = True

    return render(request, 'developers/apps/ratings/ratings_edit.html',
                  {'addon': addon, 'app_name': get_iarc_app_title(addon),
                   'form': form,
                   # Force double escaping of developer name. If this has HTML
                   # entities we want the escaped version to be passed to IARC.
                   # See bug 962362.
                   'company': jinja2.escape(unicode(
                       jinja2.escape(addon.latest_version.developer_name))),
                   'now': datetime.now().strftime('%Y-%m-%d %H:%M:%S')})
开发者ID:lissyx,项目名称:zamboni,代码行数:38,代码来源:views.py


示例9: content_ratings_edit

def content_ratings_edit(request, addon_id, addon):
    initial = {}
    try:
        app_info = addon.iarc_info
        initial['submission_id'] = app_info.submission_id
        initial['security_code'] = app_info.security_code
    except IARCInfo.DoesNotExist:
        pass
    messages.debug(request,
                   "DEBUG mode on; you may use IARC id 0 with any code")
    form = IARCGetAppInfoForm(data=request.POST or None, initial=initial,
                              app=addon)

    if request.method == 'POST' and form.is_valid():
        try:
            form.save()
            return redirect(addon.get_dev_url('ratings'))
        except django_forms.ValidationError:
            pass  # Fall through to show the form error.

    # Save some information for _ratings_success_msg.
    if 'ratings_edit' not in request.session:
        request.session['ratings_edit'] = {}
    last_rated = addon.last_rated_time()
    request.session['ratings_edit'][str(addon.id)] = {
        'app_status': addon.status,
        'rating_modified': last_rated.isoformat() if last_rated else None
    }
    request.session.modified = True

    return render(request, 'developers/apps/ratings/ratings_edit.html',
                  {'addon': addon,
                   'app_name': get_iarc_app_title(addon),
                   'form': form,
                   'company': addon.latest_version.developer_name,
                   'now': datetime.now().strftime('%Y-%m-%d %H:%M:%S')})
开发者ID:patilkr,项目名称:zamboni,代码行数:36,代码来源:views.py


示例10: content_ratings_edit

def content_ratings_edit(request, addon_id, addon):
    initial = {}
    try:
        app_info = addon.iarc_info
        initial['submission_id'] = app_info.submission_id
        initial['security_code'] = app_info.security_code
    except IARCInfo.DoesNotExist:
        pass

    form = IARCGetAppInfoForm(data=request.POST or None, initial=initial)

    if request.method == 'POST' and form.is_valid():
        try:
            form.save(addon)
            return redirect(addon.get_dev_url('ratings'))
        except django_forms.ValidationError:
            pass  # Fall through to show the form error.

    with amo.utils.no_translation(addon.default_locale):
        addon_delocalized = Addon.objects.get(pk=addon.pk)

    # If dev gets rating thru IARC tool, JS will redirect. Use session to know
    # whether to display a success message when hitting the summary page.
    request.session['ratings_last_modified'] = None
    if addon.is_rated():
        request.session['ratings_last_modified'] = (
            addon.content_ratings.order_by('-modified')[0].modified
        )

    return jingo.render(
        request, 'developers/apps/ratings/ratings_edit.html', {
            'addon': addon,
            'app_name': addon_delocalized.name,
            'form': form,
            'now': datetime.now().strftime('%Y-%m-%d %H:%M:%S')
        })
开发者ID:hardikj,项目名称:zamboni,代码行数:36,代码来源:views.py



注:本文中的mkt.developers.forms.IARCGetAppInfoForm类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python forms.NewPackagedAppForm类代码示例发布时间:2022-05-27
下一篇:
Python forms.CategoryForm类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap