コード例 #1
0
ファイル: views.py プロジェクト: sholokhova/gecko2
def issue_edit(request, id):
    issue = Issue.objects.get(pk=id)
    if request.method == "POST":
        form = IssueForm(request.POST, instance=issue)
        if form.is_valid():
            form.save()
            return render_to_response("common/success.html")
    else:
        form = IssueForm(instance=issue)

    variables = RequestContext(request, {"form": form})

    return render_to_response("crud/issues/issue_edit.html", variables)
コード例 #2
0
ファイル: views.py プロジェクト: sholokhova/gecko2
def issue_add(request):
    if request.method == "POST":
        form = IssueForm(request.POST)
        if form.is_valid():
            form.save()
            return render_to_response("common/success.html")
    else:
        issue = Issue(issue_out=date.today(), issue_in=date.today() + timedelta(days=10))
        form = IssueForm(instance=issue)

    variables = RequestContext(request, {"form": form})

    return render_to_response("crud/issues/issue_add.html", variables)
コード例 #3
0
def issue_edit(request, id):
    issue = Issue.objects.get(pk=id)
    if request.method == "POST":
        form = IssueForm(request.POST, instance=issue)
        if form.is_valid():
            form.save()
            return render_to_response('common/success.html')
    else:
        form = IssueForm(instance=issue)

    variables = RequestContext(request, {'form': form})

    return render_to_response("crud/issues/issue_edit.html", variables)
コード例 #4
0
def issue_add(request):
    if request.method == 'POST':
        form = IssueForm(request.POST)
        if form.is_valid():
            form.save()
            return render_to_response('common/success.html')
    else:
        issue = Issue(issue_out=date.today(),
                      issue_in=date.today() + timedelta(days=10))
        form = IssueForm(instance=issue)

    variables = RequestContext(request, {'form': form})

    return render_to_response('crud/issues/issue_add.html', variables)