Rename project #41

Merged
lukas merged 7 commits from rename-project into main 2023-01-19 19:35:26 +00:00
1 changed files with 7 additions and 1 deletions
Showing only changes of commit 0224afcad9 - Show all commits

View File

@ -21,9 +21,15 @@ def model_counts(request):
def add_session(request): def add_session(request):
context = {} context = {}
initial = {}
now = now_with_tz() now = now_with_tz()
initial["timestamp_start"] = now
last = Session.objects.all().last() last = Session.objects.all().last()
initial = {"timestamp_start": now, "purchase": last.purchase} if last != None:
initial["purchase"] = last.purchase
form = SessionForm(request.POST or None, initial=initial) form = SessionForm(request.POST or None, initial=initial)
if form.is_valid(): if form.is_valid():
form.save() form.save()