Fix bug editing budgets

This commit is contained in:
Yingtong Li 2020-01-07 22:11:17 +11:00
parent cdb3518b28
commit f46f966bbb
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A

View File

@ -257,11 +257,12 @@ def budget_edit(request, budget, revision):
return redirect(reverse('budget_list'))
with transaction.atomic():
revision = models.BudgetRevision()
revision.author = request.user
revision.time = timezone.now()
revision.action = models.BudgetAction.EDIT.value
revision = revision_from_form(budget, revision, request.POST)
new_revision = models.BudgetRevision()
new_revision.author = request.user
new_revision.time = timezone.now()
new_revision.action = models.BudgetAction.EDIT.value
new_revision.state = revision.state
new_revision = revision_from_form(budget, new_revision, request.POST)
if request.POST['submit'] == 'Save':
return redirect(reverse('budget_view', kwargs={'id': budget.id}))