From febff54c6b5792695958c0b2c2a292fbd0b79cd4 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 13 Apr 2022 13:28:22 +0200 Subject: [PATCH] fix bug --- ereuse_devicehub/forms.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ereuse_devicehub/forms.py b/ereuse_devicehub/forms.py index c5ede0cc..0194a855 100644 --- a/ereuse_devicehub/forms.py +++ b/ereuse_devicehub/forms.py @@ -1,5 +1,6 @@ from flask import g from flask_wtf import FlaskForm +from teal.enums import Country from werkzeug.security import generate_password_hash from wtforms import ( BooleanField, @@ -11,7 +12,6 @@ from wtforms import ( ) from ereuse_devicehub.db import db -from ereuse_devicehub.enums import Country from ereuse_devicehub.resources.user.models import User COUNTRY = [(x.name, x.value) for x in Country] @@ -104,7 +104,8 @@ class ProfileForm(FlaskForm): self.last_name.data = user.last_name self.email.data = user.email self.telephone.data = user.telephone - self.country.data = user.country.name + if user.country: + self.country.data = user.country.name def save(self, commit=True): agent = g.user.individual