conditionally set username so it can work local and in tests

This commit is contained in:
Oliver Zander 2025-08-18 16:33:04 +02:00 committed by Tobias Herre
parent fe8985504e
commit 233151968b
1 changed files with 3 additions and 3 deletions

View File

@ -219,8 +219,6 @@ class ExternView(CookieWizardView):
for form in form_list: for form in form_list:
data = {**data, **form.cleaned_data} data = {**data, **form.cleaned_data}
data['username'] = self.request.session['user']['username']
if data['choice'] == 'LIT': if data['choice'] == 'LIT':
if data['selfbuy'] == 'TRUE': if data['selfbuy'] == 'TRUE':
data['selfbuy_give_data'] = 'False' data['selfbuy_give_data'] = 'False'
@ -233,8 +231,10 @@ class ExternView(CookieWizardView):
if data['choice'] == 'LIT': if data['choice'] == 'LIT':
modell.selfbuy_give_data = data['selfbuy_give_data'] modell.selfbuy_give_data = data['selfbuy_give_data']
if user := self.request.session.get('user'):
modell.username = user['username']
modell.realname = data['realname'] modell.realname = data['realname']
modell.username = data['username']
modell.email = data['email'] modell.email = data['email']
# write type of form in some cases # write type of form in some cases
if data['choice'] in ('BIB', 'ELIT', 'SOFT'): if data['choice'] in ('BIB', 'ELIT', 'SOFT'):