# HG changeset patch # User Dennis Fink # Date 2022-01-17 21:36:09 # Node ID 3e495ae230a24562927d173cc2093a9e1627e2f0 # Parent 6bf058a7b4861c1ebba3c11f2809789ac519c818 Mark fields that are not required as explicitly optional diff --git a/c3l_membership/forms.py b/c3l_membership/forms.py --- a/c3l_membership/forms.py +++ b/c3l_membership/forms.py @@ -63,30 +63,30 @@ class MembershipForm(FlaskForm): validators=[InputRequired(lazy_gettext("Please select one of the options!"))], ) - birthday = DateField(lazy_gettext("Birthday")) + birthday = DateField(lazy_gettext("Birthday"), validators=[Optional()]) street = StringField( lazy_gettext("Nr., Street"), - validators=[Length(max=4000)], + validators=[Optional(), Length(max=4000)], ) zip = StringField( lazy_gettext("Postal Code"), - validators=[Length(max=30)], + validators=[Optional(), Length(max=30)], ) city = StringField( lazy_gettext("City/Town"), - validators=[Length(max=500)], + validators=[Optional(), Length(max=500)], ) state = StringField( lazy_gettext("State/County/Province"), - validators=[Length(max=500)], + validators=[Optional(), Length(max=500)], ) country = StringField( lazy_gettext("Country"), - validators=[Length(max=500)], + validators=[Optional(), Length(max=500)], ) terms = BooleanField( diff --git a/c3l_membership/views.py b/c3l_membership/views.py --- a/c3l_membership/views.py +++ b/c3l_membership/views.py @@ -73,7 +73,9 @@ def index(): xml_data["status"] = "Regular" xml_data["name"] = form.fullname.data - xml_data["birthday"] = form.birthday.data + xml_data["birthday"] = ( + form.birthday.data if form.birthday.data is not None else date(9999, 12, 12) + ) xml_data["username"] = form.username.data xml_data["email"] = form.email.data xml_data["address"] = " ".join(