Added teachers and room # to success strings
This commit is contained in:
parent
58e3b16455
commit
549c152c1d
1 changed files with 32 additions and 2 deletions
|
|
@ -37,7 +37,7 @@ class EntryCreateView(SessionWizardView):
|
|||
'activity1', filter=Q(activity1__house=cd.get('user-house')))).filter(final_quota__gt=F('count'))
|
||||
|
||||
filtered2 = Activity.objects.annotate(final_quota=Coalesce(Subquery(quota[:1]), F('default_quota'))).annotate(count=Count(
|
||||
'activity1', filter=Q(activity2__house=cd.get('user-house')))).filter(final_quota__gt=F('count'), time=30)
|
||||
'activity2', filter=Q(activity2__house=cd.get('user-house')))).filter(final_quota__gt=F('count'), time=30)
|
||||
|
||||
# Render filtered as choices in activity select step
|
||||
form.fields['activity1'].queryset = filtered1
|
||||
|
|
@ -46,9 +46,39 @@ class EntryCreateView(SessionWizardView):
|
|||
return form
|
||||
|
||||
def done(self, form_list, **kwargs):
|
||||
UserEntry.objects.create(**self.get_all_cleaned_data())
|
||||
cleaned_data = self.get_all_cleaned_data()
|
||||
UserEntry.objects.create(**cleaned_data)
|
||||
|
||||
activity1 = cleaned_data['activity1']
|
||||
activity1_room = activity1.room_number
|
||||
activity1_teacher = activity1.teacher.last_name
|
||||
activity2 = cleaned_data['activity2']
|
||||
activity2_room = activity2.room_number
|
||||
activity2_teacher = activity1.teacher.last_name
|
||||
|
||||
# Build the response string.
|
||||
a1_string = f'You are in {activity1}'
|
||||
if (activity1_room != None):
|
||||
a1_string += f' in Room {activity1_room}'
|
||||
if (activity1_teacher != None):
|
||||
a1_string += f' with {activity1_teacher}.'
|
||||
else:
|
||||
a1_string += '.'
|
||||
|
||||
a2_string = ''
|
||||
if (activity2 != None):
|
||||
a2_string = f'You are in {activity2}'
|
||||
if (activity2_room != None):
|
||||
a2_string += f' in Room {activity2_room}'
|
||||
if (activity2_teacher != None):
|
||||
a2_string += f' with {activity2_teacher}.'
|
||||
else:
|
||||
a2_string += '.'
|
||||
|
||||
messages.success(self.request, 'Your signup has been submitted.')
|
||||
messages.success(self.request, a1_string)
|
||||
messages.success(self.request, a2_string)
|
||||
|
||||
return redirect('housewars:signup')
|
||||
|
||||
def get_success_url(self):
|
||||
|
|
|
|||
Reference in a new issue