Esempio n. 1
0
def remove_event(request, _id):
    """
    Remove an Event.

    :param request: Django request object (Required)
    :type request: :class:`django.http.HttpRequest`
    :param _id: The ObjectId of the event to remove.
    :type _id: str
    :returns: :class:`django.http.HttpResponse`, :class:`django.http.HttpResponse`
    """

    user = request.user

    if user.has_access_to(EventACL.DELETE):
        result = event_remove(_id, '%s' % user.username)
    else:
        result['success'] = False
        result['message'] = "User does not have permission to remove Event."

    if result['success']:
        return HttpResponseRedirect(
            reverse('crits.events.views.events_listing'))

    else:
        return render_to_response('error.html', {'error': result['message']},
                                  RequestContext(request))
Esempio n. 2
0
def remove_event(request, _id):
    """
    Remove an Event.

    :param request: Django request object (Required)
    :type request: :class:`django.http.HttpRequest`
    :param _id: The ObjectId of the event to remove.
    :type _id: str
    :returns: :class:`django.http.HttpResponse`, :class:`django.http.HttpResponse`
    """

    user = request.user

    if user.has_access_to(EventACL.DELETE):
        result = event_remove(_id, '%s' % user.username)
    else:
        result['success'] = False
        result['message'] = "User does not have permission to remove Event."

    if result['success']:
        return HttpResponseRedirect(
            reverse('crits-events-views-events_listing')
        )

    else:
        return render(request, 'error.html', {'error': result['message']})
Esempio n. 3
0
def remove_event(request, _id):
    """
    Remove an Event.

    :param request: Django request object (Required)
    :type request: :class:`django.http.HttpRequest`
    :param _id: The ObjectId of the event to remove.
    :type _id: str
    :returns: :class:`django.http.HttpResponse`, :class:`django.http.HttpResponse`
    """

    result = event_remove(_id, '%s' % request.user.username)
    if result['success']:
        return HttpResponseRedirect(
            reverse('crits.events.views.events_listing'))
    else:
        return render_to_response('error.html', {'error': result['message']},
                                  RequestContext(request))
Esempio n. 4
0
File: views.py Progetto: ckane/crits
def remove_event(request, _id):
    """
    Remove an Event.

    :param request: Django request object (Required)
    :type request: :class:`django.http.HttpRequest`
    :param _id: The ObjectId of the event to remove.
    :type _id: str
    :returns: :class:`django.http.HttpResponse`, :class:`django.http.HttpResponse`
    """

    result = event_remove(_id, '%s' % request.user.username)
    if result['success']:
        return HttpResponseRedirect(
            reverse('crits.events.views.events_listing')
        )
    else:
        return render_to_response('error.html',
                                  {'error': result['message']},
                                  RequestContext(request))