From c7eebab2bb11d8556184187815ddfa1d43d17e78 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Thu, 26 Jun 2025 09:31:02 +0200 Subject: [PATCH] fix no user after registration --- pyproject.toml | 2 +- setup.py | 2 +- teleforma/__init__.py | 2 +- teleforma/views/crfpa.py | 15 +++++++++++---- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4dd72170..6a0c8609 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "teleforma" -version = "2.8.0" +version = "2.14.1" description = "e-learning platform based on streaming" authors = ["Guillaume Pellerin "] license = "CeCILL v2" diff --git a/setup.py b/setup.py index 2e0ea354..b6722329 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ setup( long_description = open('README.rst').read(), author = "Guillaume Pellerin", author_email = "yomguy@parisson.com", - version = '2.14.0', + version = '2.14.1', platforms=['OS Independent'], license='CeCILL v2', classifiers = CLASSIFIERS, diff --git a/teleforma/__init__.py b/teleforma/__init__.py index 4ed0b2dd..0ab15014 100644 --- a/teleforma/__init__.py +++ b/teleforma/__init__.py @@ -9,7 +9,7 @@ U{http://parisson.com/products/teleforma} """ __docformat__ = 'epytext en' -__version__ = '2.14.0' +__version__ = '2.14.1' __url__ = 'https://github.com/Parisson/TeleForma' __copyright__ = '(C) 2011-2024 Parisson' __license__ = 'CeCILL-v2' diff --git a/teleforma/views/crfpa.py b/teleforma/views/crfpa.py index f28fe8e7..384955c8 100644 --- a/teleforma/views/crfpa.py +++ b/teleforma/views/crfpa.py @@ -67,7 +67,7 @@ from ..models.core import Course, CourseType, Document, NamePaginator, Period from ..models.crfpa import (IEJ, Discount, NewsItem, Parameters, Payback, Payment, Profile, Student, Training, months_choices, payment_choices) from ..views.core import (CourseAccessMixin, PDFTemplateResponseMixin, format_courses, - get_courses, get_periods) + get_courses, get_periods, get_default_period) from ..views.profile import ProfileView def get_course_code(obj): @@ -764,9 +764,16 @@ class UserCompleteView(TemplateView): context = super(UserCompleteView, self).get_context_data(**kwargs) # context['register_doc_print'] = Document.objects.get(id=settings.TELEFORMA_REGISTER_DEFAULT_DOC_ID) context['username'] = kwargs['username'] - user = User.objects.get(username=kwargs['username']) - student = user.student.all()[0] - context['period'] = student.period + user = None + try: + user = User.objects.get(username=kwargs['username']) + except: + user = self.request.user + if user: + student = user.student.all()[0] + context['period'] = student.period + else: + context['period'] = get_default_period() return context -- 2.39.5