From b7688a9c9b95170c585f333eb67e043586381163 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Thu, 4 Feb 2016 10:07:15 +0100 Subject: [PATCH] various string fixes --- teleforma/views/crfpa.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/teleforma/views/crfpa.py b/teleforma/views/crfpa.py index f2b273bf..a174e8ba 100644 --- a/teleforma/views/crfpa.py +++ b/teleforma/views/crfpa.py @@ -408,9 +408,9 @@ class UserAddView(CreateWithInlinesView): last_name = form.cleaned_data['last_name'] username = get_unique_username(first_name, last_name) self.username = username - # form.cleaned_data['username'] = username user = form.save() user.username = username + user.last_name = last_name.uuper() user.is_active = False user.save() return super(UserAddView, self).forms_valid(form, inlines) @@ -441,12 +441,18 @@ class RegistrationPDFView(PDFTemplateResponseMixin, TemplateView): def get_context_data(self, **kwargs): context = super(RegistrationPDFView, self).get_context_data(**kwargs) user = User.objects.get(username=kwargs['username']) - # user = self.get_object() + + # some form fixes student = user.student.all()[0] if student.training and not student.trainings.all(): student.trainings.add(student.training) if not student.training and student.trainings.all(): student.training = student.trainings.all()[0] + student.save() + profile = user.profile.all()[0] + if profile.city: + profile.city = profile.city.upper() + profile.save() context['student'] = student return context -- 2.39.5