fix date_expiration

This commit is contained in:
Emmanuel Viennet 2021-08-22 07:47:41 +02:00
parent 12b903f02e
commit 9c51deed48

View File

@ -397,9 +397,12 @@ def create_user_form(REQUEST, user_name=None, edit=0):
del vals["status"] # no one can't change its own status
if "date_expiration" in vals:
try:
vals["date_expiration"] = datetime.datetime.strptime(
vals["date_expiration"], "%d/%m/%Y"
)
if vals["date_expiration"]:
vals["date_expiration"] = datetime.datetime.strptime(
vals["date_expiration"], "%d/%m/%Y"
)
else:
vals["date_expiration"] = None
except ValueError:
H.append(tf_error_message("date expiration invalide"))
return "\n".join(H) + "\n" + tf[1] + F