Enter wrong membership range causes crash
Enter a membership request date with end date < start date causes:
clubhub_1 | [2022-11-10 08:19:21,572] ERROR in app: Exception on /membership/request-membership [POST]
clubhub_1 | Traceback (most recent call last):
clubhub_1 | File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 2525, in wsgi_app
clubhub_1 | response = self.full_dispatch_request()
clubhub_1 | File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1822, in full_dispatch_request
clubhub_1 | rv = self.handle_user_exception(e)
clubhub_1 | File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1820, in full_dispatch_request
clubhub_1 | rv = self.dispatch_request()
clubhub_1 | File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1796, in dispatch_request
clubhub_1 | return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
clubhub_1 | File "/usr/local/lib/python3.10/site-packages/flask_login/utils.py", line 290, in decorated_view
clubhub_1 | return current_app.ensure_sync(func)(*args, **kwargs)
clubhub_1 | File "/opt/clubhub/membership/views/user.py", line 44, in request_membership
clubhub_1 | if form.validate_on_submit():
clubhub_1 | File "/usr/local/lib/python3.10/site-packages/flask_wtf/form.py", line 86, in validate_on_submit
clubhub_1 | return self.is_submitted() and self.validate()
clubhub_1 | File "/opt/clubhub/membership/forms.py", line 33, in validate
clubhub_1 | return validate_time_range(
clubhub_1 | File "/opt/clubhub/utils.py", line 68, in validate_time_range
clubhub_1 | raise ValidationError('"Valid Till" must be later than "Valid From".')
clubhub_1 | wtforms.validators.ValidationError: "Valid Till" must be later than "Valid From".
Edited by Artur Scholz