Example #1
0
File: views.py Project: boxed/curia
def delete_file(request, file_id):
    file = get_object_or_404_and_check_access(request, File, pk=file_id, command='delete')
    
    from curia import delete_object
    delete_object(file)
    
    return HttpResponse(dumps(file_id, ensure_ascii=False), content_type="text/json; charset=UTF-8")
Example #2
0
File: views.py Project: boxed/curia
def delete_event(request, event_id):
    from curia import delete_object
    event = Event.objects.get(pk=event_id)
    check_access(request.user, event, command='change event')
    delete_object(event)
    
    #Change any children
    if not event.event_parent:
        event_children = event.event_children.all()
        for child in event_children:
            try:
                child.description = _("This event has been deleted by its creator.")
                child.save()
            except:
                pass            
  
    #If this is a copy, change answer to no.
    if event.event_parent:
        parent = event.event_parent
        reply = get_object_or_404(Reply, event=parent, user=request.user)
        reply.choice = 'N'
        reply.save()
    
    mark_labels_as_deleted(event, request.user)
  
    from django.core import serializers
    return HttpResponse(dumps(event_id, ensure_ascii=False), content_type="text/json; charset=UTF-8")
Example #3
0
File: views.py Project: boxed/curia
def delete_event(request, event_id):
    from curia import delete_object

    event = Event.objects.get(pk=event_id)
    check_access(request.user, event, command="change event")
    delete_object(event)

    # Change any children
    if not event.event_parent:
        event_children = event.event_children.all()
        for child in event_children:
            try:
                child.description = _("This event has been deleted by its creator.")
                child.save()
            except:
                pass

    # If this is a copy, change answer to no.
    if event.event_parent:
        parent = event.event_parent
        reply = get_object_or_404(Reply, event=parent, user=request.user)
        reply.choice = "N"
        reply.save()

    mark_labels_as_deleted(event, request.user)

    from django.core import serializers

    return HttpResponse(dumps(event_id, ensure_ascii=False), content_type="text/json; charset=UTF-8")
Example #4
0
def delete_file(request, file_id):
    file = get_object_or_404_and_check_access(request,
                                              File,
                                              pk=file_id,
                                              command='delete')

    from curia import delete_object
    delete_object(file)

    return HttpResponse(dumps(file_id, ensure_ascii=False),
                        content_type="text/json; charset=UTF-8")