Hotfix assurer un profil aux gens

This commit is contained in:
Evarin 2019-08-07 18:14:33 +02:00
parent 66c278341c
commit 318b1dda78
2 changed files with 8 additions and 0 deletions

View file

@ -86,6 +86,7 @@ def create_user_profile(sender, instance, created, **kwargs):
saccount = SocialAccount.objects.get(user=instance, saccount = SocialAccount.objects.get(user=instance,
provider="clipper") provider="clipper")
except SocialAccount.DoesNotExist: except SocialAccount.DoesNotExist:
profil.save()
return return
edata = saccount.extra_data.get("ldap", {}) edata = saccount.extra_data.get("ldap", {})
dep = "" dep = ""

View file

@ -36,6 +36,13 @@ def index(request):
# Espace personnel # Espace personnel
@login_required @login_required
def perso(request): 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') return render(request, 'avisstage/perso.html')
# 403 Archicubes # 403 Archicubes