Exemplo n.º 1
0
def issues_bulk_delete():
    form = BulkDeleteForm()

    if form.validate_on_submit():
        ids = Issue.get_bulk_action_ids(request.form.get('scope'),
                                        request.form.getlist('bulk_ids'),
                                        query=request.args.get('q', ''))

        delete_count = Issue.bulk_delete(ids)

        flash(_n('%(num)d issue was deleted.',
                 '%(num)d issues were deleted.',
                 num=delete_count), 'success')
    else:
        flash(_('No issues were deleted, something went wrong.'), 'error')

    return redirect(url_for('admin.issues'))
Exemplo n.º 2
0
def coupons_bulk_delete():
    form = BulkDeleteForm()

    if form.validate_on_submit():
        ids = Coupon.get_bulk_action_ids(request.form.get('scope'),
                                         request.form.getlist('bulk_ids'),
                                         query=request.args.get('q', ''))

        # Prevent circular imports.
        from catwatch.blueprints.billing.tasks import delete_coupons

        delete_coupons.delay(ids)

        flash(_n('%(num)d coupon was scheduled to be deleted.',
                 '%(num)d coupons were scheduled to be deleted.',
                 num=len(ids)), 'success')
    else:
        flash(_('No coupons were deleted, something went wrong.'), 'error')

    return redirect(url_for('admin.coupons'))