diff --git a/avisstage/models.py b/avisstage/models.py index dfc06f1..4cbf780 100644 --- a/avisstage/models.py +++ b/avisstage/models.py @@ -86,6 +86,7 @@ def create_user_profile(sender, instance, created, **kwargs): saccount = SocialAccount.objects.get(user=instance, provider="clipper") except SocialAccount.DoesNotExist: + profil.save() return edata = saccount.extra_data.get("ldap", {}) dep = "" diff --git a/avisstage/views.py b/avisstage/views.py index ce7cee0..2bcb19c 100644 --- a/avisstage/views.py +++ b/avisstage/views.py @@ -36,6 +36,13 @@ def index(request): # Espace personnel @login_required def perso(request): + # HOTFIX (TODO rendre ça plus propre) + # Vérifie que le profil existe bien + # (suite à un cas où il n'avait pas été initialisé) + if not hasattr(request.user, "profil"): + profil, created = Normalien.objects.get_or_create(user=request.user) + profil.save() + return render(request, 'avisstage/perso.html') # 403 Archicubes