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)
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)
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)
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)