コード例 #1
0
ファイル: views.py プロジェクト: aditbiswas1/olympia
def queue_moderated(request):
    rf = (Review.objects.exclude(Q(addon__isnull=True) |
                                 Q(reviewflag__isnull=True))
                        .filter(editorreview=1)
                        .order_by('reviewflag__created'))

    page = paginate(request, rf, per_page=20)

    flags = dict(ReviewFlag.FLAGS)

    reviews_formset = ReviewFlagFormSet(request.POST or None,
                                        queryset=page.object_list,
                                        request=request)

    if request.method == 'POST':
        if reviews_formset.is_valid():
            reviews_formset.save()
        else:
            amo.messages.error(
                request, ' '.join(e.as_text() or _('An unknown error occurred')
                                  for e in reviews_formset.errors))
        return redirect(reverse('editors.queue_moderated'))

    return render(request, 'editors/queue.html',
                  context(reviews_formset=reviews_formset,
                          tab='moderated', page=page, flags=flags,
                          search_form=None,
                          point_types=amo.REVIEWED_AMO))
コード例 #2
0
ファイル: views.py プロジェクト: ddurst/olympia
def queue_moderated(request):
    # In addition to other checks, this only show reviews for public and
    # listed add-ons. Unlisted add-ons typically won't have reviews anyway
    # but they might if their status ever gets changed.
    rf = (Review.objects.exclude(Q(addon__isnull=True) |
                                 Q(addon__is_listed=False) |
                                 Q(reviewflag__isnull=True))
                        .filter(editorreview=1,
                                addon__status__in=amo.LISTED_STATUSES)
                        .order_by('reviewflag__created'))

    page = paginate(request, rf, per_page=20)
    motd_editable = acl.action_allowed(request, 'AddonReviewerMOTD', 'Edit')

    flags = dict(ReviewFlag.FLAGS)

    reviews_formset = ReviewFlagFormSet(request.POST or None,
                                        queryset=page.object_list,
                                        request=request)

    if request.method == 'POST':
        if reviews_formset.is_valid():
            reviews_formset.save()
        else:
            amo.messages.error(
                request, ' '.join(e.as_text() or _('An unknown error occurred')
                                  for e in reviews_formset.errors))
        return redirect(reverse('editors.queue_moderated'))

    return render(request, 'editors/queue.html',
                  context(request, reviews_formset=reviews_formset,
                          tab='moderated', page=page, flags=flags,
                          search_form=None,
                          point_types=amo.REVIEWED_AMO,
                          motd_editable=motd_editable))
コード例 #3
0
def queue_moderated(request):
    rf = (Review.objects.exclude(
        Q(addon__isnull=True) | Q(reviewflag__isnull=True)).filter(
            editorreview=1).order_by('reviewflag__created'))

    page = paginate(request, rf, per_page=20)

    flags = dict(ReviewFlag.FLAGS)

    reviews_formset = ReviewFlagFormSet(request.POST or None,
                                        queryset=page.object_list,
                                        request=request)

    if request.method == 'POST':
        if reviews_formset.is_valid():
            reviews_formset.save()
        else:
            amo.messages.error(
                request, ' '.join(e.as_text() or _('An unknown error occurred')
                                  for e in reviews_formset.errors))
        return redirect(reverse('editors.queue_moderated'))

    return render(
        request, 'editors/queue.html',
        context(reviews_formset=reviews_formset,
                tab='moderated',
                page=page,
                flags=flags,
                search_form=None,
                point_types=amo.REVIEWED_AMO))
コード例 #4
0
ファイル: views.py プロジェクト: PinZhang/zamboni
def queue_moderated(request):
    rf = (Review.objects.filter(editorreview=1, reviewflag__isnull=False,
                                addon__isnull=False)
                        .order_by('reviewflag__created'))

    page = paginate(request, rf, per_page=20)

    flags = dict(ReviewFlag.FLAGS)

    reviews_formset = ReviewFlagFormSet(request.POST or None,
                                        queryset=page.object_list)

    if reviews_formset.is_valid():
        reviews_formset.save()
        return redirect(reverse('editors.queue_moderated'))

    return jingo.render(request, 'editors/queue.html',
                        context(reviews_formset=reviews_formset,
                                tab='moderated', page=page, flags=flags,
                                search_form=None))
コード例 #5
0
ファイル: views.py プロジェクト: lissyx/zamboni
def queue_moderated(request):
    """Queue for reviewing app reviews."""
    rf = (Review.objects.no_cache()
                .exclude(Q(addon__isnull=True) | Q(reviewflag__isnull=True))
                .filter(addon__type=amo.ADDON_WEBAPP, editorreview=True)
                .order_by('reviewflag__created'))

    page = paginate(request, rf, per_page=20)
    flags = dict(ReviewFlag.FLAGS)
    reviews_formset = ReviewFlagFormSet(request.POST or None,
                                        queryset=page.object_list,
                                        request=request)

    if reviews_formset.is_valid():
        reviews_formset.save()
        return redirect(reverse('reviewers.apps.queue_moderated'))

    return render(request, 'reviewers/queue.html',
                  context(request, reviews_formset=reviews_formset,
                          tab='moderated', page=page, flags=flags))
コード例 #6
0
ファイル: views.py プロジェクト: sunbiz/zamboni
def queue_moderated(request):
    """Queue for reviewing app reviews."""
    rf = (Review.objects.no_cache()
                .exclude(Q(addon__isnull=True) | Q(reviewflag__isnull=True))
                .filter(addon__type=amo.ADDON_WEBAPP, editorreview=True)
                .order_by('reviewflag__created'))

    page = paginate(request, rf, per_page=20)
    flags = dict(ReviewFlag.FLAGS)
    reviews_formset = ReviewFlagFormSet(request.POST or None,
                                        queryset=page.object_list,
                                        request=request)

    if reviews_formset.is_valid():
        reviews_formset.save()
        return redirect(reverse('reviewers.apps.queue_moderated'))

    return jingo.render(request, 'reviewers/queue.html',
                        context(request, reviews_formset=reviews_formset,
                                tab='moderated', page=page, flags=flags))
コード例 #7
0
def queue_moderated(request):
    rf = (Review.objects.filter(editorreview=1, reviewflag__isnull=False,
                                addon__isnull=False)
                        .order_by('reviewflag__created'))

    page = paginate(request, rf, per_page=20)

    flags = dict(ReviewFlag.FLAGS)

    reviews_formset = ReviewFlagFormSet(request.POST or None,
                                        queryset=page.object_list)

    if reviews_formset.is_valid():
        reviews_formset.save()
        return redirect(reverse('editors.queue_moderated'))

    return jingo.render(request, 'editors/queue.html',
                        context(reviews_formset=reviews_formset,
                                tab='moderated', page=page, flags=flags,
                                search_form=None))
コード例 #8
0
def queue_moderated(request):
    rf = (
        Review.objects.exclude(Q(addon__type=amo.ADDON_WEBAPP) | Q(addon__isnull=True) | Q(reviewflag__isnull=True))
        .filter(editorreview=1)
        .order_by("reviewflag__created")
    )

    page = paginate(request, rf, per_page=20)

    flags = dict(ReviewFlag.FLAGS)

    reviews_formset = ReviewFlagFormSet(request.POST or None, queryset=page.object_list)

    if reviews_formset.is_valid():
        reviews_formset.save()
        return redirect(reverse("editors.queue_moderated"))

    return jingo.render(
        request,
        "editors/queue.html",
        context(reviews_formset=reviews_formset, tab="moderated", page=page, flags=flags, search_form=None),
    )
コード例 #9
0
ファイル: views.py プロジェクト: peterkinalex/olympia
def queue_moderated(request):
    # In addition to other checks, this only show reviews for public and
    # listed add-ons. Unlisted add-ons typically won't have reviews anyway
    # but they might if their status ever gets changed.
    rf = (Review.objects.exclude(
        Q(addon__isnull=True) | Q(addon__is_listed=False)
        | Q(reviewflag__isnull=True)).filter(
            editorreview=1, addon__status__in=amo.LISTED_STATUSES).order_by(
                'reviewflag__created'))

    page = paginate(request, rf, per_page=20)
    motd_editable = acl.action_allowed(request, 'AddonReviewerMOTD', 'Edit')

    flags = dict(ReviewFlag.FLAGS)

    reviews_formset = ReviewFlagFormSet(request.POST or None,
                                        queryset=page.object_list,
                                        request=request)

    if request.method == 'POST':
        if reviews_formset.is_valid():
            reviews_formset.save()
        else:
            amo.messages.error(
                request, ' '.join(e.as_text() or _('An unknown error occurred')
                                  for e in reviews_formset.errors))
        return redirect(reverse('editors.queue_moderated'))

    return render(
        request, 'editors/queue.html',
        context(request,
                reviews_formset=reviews_formset,
                tab='moderated',
                page=page,
                flags=flags,
                search_form=None,
                point_types=amo.REVIEWED_AMO,
                motd_editable=motd_editable))