これは、バックアップを作成して元のファイルを更新するための正しいアプローチですか?
project = Project.objects.get(pk=project_id)
# ...
if request.method == "POST": # If the form has been submitted...
project_form = ProjectForm(request.POST, instance=project)
if project_form.is_valid():
project.save(force_insert=True) # Make a backup copy
updated_project = project_form.save(commit=False)
updated_project.editor_id = editor_id
if request.POST["beginyear"]: by = int(request.POST["beginyear"])
if request.POST["beginmonth"]: bm = int(request.POST["beginmonth"])
if (by > 0) and (bm > 0):
updated_project.begin_date = "%4.4d-%2.2d-01" % (by,bm,)
# ...
updated_project.save()