Beispiel #1
0
def create(request, incident_id):
    incident = get_object_or_404(Incident, pk=incident_id)

    form = TodoItemForm(request.POST)
    item = form.save(commit=False)
    item.incident = incident
    item.category = incident.category
    item.done = False
    item.save()

    return render(request, 'fir_todos/single.html', {'item': item})
Beispiel #2
0
def create(request, incident_id):
	incident = get_object_or_404(Incident, pk=incident_id)

	form = TodoItemForm(request.POST)
	item = form.save(commit=False)
	item.incident = incident
	item.category = incident.category
	item.done = False
	item.save()

	return render(request, 'fir_todos/single.html', {'item': item})
Beispiel #3
0
def create(request, incident_id, authorization_target=None):
    if authorization_target is None:
        incident = get_object_or_404(Incident.authorization.for_user(
            request.user, 'incidents.handle_incidents'),
                                     pk=incident_id)
    else:
        incident = authorization_target

    form = TodoItemForm(request.POST, for_user=request.user)
    item = form.save(commit=False)
    item.incident = incident
    item.category = incident.category
    item.done = False
    item.save()

    return render(request, 'fir_todos/single.html', {'item': item})
Beispiel #4
0
def create(request, finding_id, authorization_target=None):
    if authorization_target is None:
        finding = get_object_or_404(Finding.authorization.for_user(
            request.user, 'findings.handle_findings'),
                                    pk=finding_id)
    else:
        finding = authorization_target

    form = TodoItemForm(request.POST, for_user=request.user)
    item = form.save(commit=False)
    item.finding = finding
    item.category = finding.category
    item.done = False
    item.save()

    return render(request, 'fir_todos/single.html', {'item': item})
Beispiel #5
0
def list(request, incident_id):
    incident = get_object_or_404(Incident, pk=incident_id)
    todos = incident.todoitem_set.all()
    form = TodoItemForm()

    return render(request, 'fir_todos/list.html', {
        'todos': todos,
        'form': form,
        'incident_id': incident_id
    })
Beispiel #6
0
def list(request, incident_id, authorization_target=None):
    if authorization_target is None:
        incident = get_object_or_404(Incident.authorization.for_user(
            request.user, 'incidents.handle_incidents'),
                                     pk=incident_id)
    else:
        incident = authorization_target
    todos = incident.todoitem_set.all()
    if request.user.has_perm('incidents.handle_incidents', obj=incident):
        form = TodoItemForm(for_user=request.user)
    else:
        form = None
    return render(request, 'fir_todos/list.html', {
        'todos': todos,
        'form': form,
        'incident_id': incident_id
    })
Beispiel #7
0
def list(request, finding_id, authorization_target=None):
    if authorization_target is None:
        finding = get_object_or_404(Finding.authorization.for_user(
            request.user, 'findings.handle_findings'),
                                    pk=finding_id)
    else:
        finding = authorization_target
    todos = finding.todoitem_set.all()
    if request.user.has_perm('findings.handle_findings', obj=finding):
        form = TodoItemForm(for_user=request.user)
    else:
        form = None
    return render(request, 'fir_todos/list.html', {
        'todos': todos,
        'form': form,
        'finding_id': finding_id
    })