@permission_required('delete_page')
def delete_attachment(request, slug, attachment_id_or_filename):
    if attachment_id_or_filename.isnumeric():
        attachment = get_object_or_404(Attachment, id=attachment_id_or_filename, page__slug=slug)
    else:
        attachment = get_object_or_404(Attachment, file__endswith=attachment_id_or_filename, page__slug=slug)
    name = text_type(attachment)
    if request.is_ajax() and ('POST', 'DELETE') in request.method:
        attachment.delete()
        return HttpResponse(json.dumps({'removed': name}), content_type="application/json")
    return HttpResponse(json.dumps({'removed': None}), content_type="application/json")
dataset/ETHPy150Open mgaitan/waliki/waliki/attachments/views.py/delete_attachment/swapped operands of `in`