Error if creating a new school term without a start and end date
There is an error if you want to create a new school term. You can create a school term without a start or an end date. Then it shows this:
Traceback:
Environment:
Request Method: POST
Request URL: http://localhost:8000/django/school_terms/create/
Django Version: 4.1.5
Python Version: 3.11.1
Installed Applications:
['django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.sites',
'django.contrib.staticfiles',
'django.contrib.humanize',
'django_uwsgi',
'django_extensions',
'guardian',
'rules.apps.AutodiscoverRulesConfig',
'haystack',
'polymorphic',
'dj_cleavejs.apps.DjCleaveJSConfig',
'dbbackup',
'django_celery_beat',
'django_celery_results',
'celery_progress',
'health_check.contrib.celery',
'djcelery_email',
'celery_haystack',
'sass_processor',
'django_any_js',
'django_yarnpkg',
'django_vite',
'django_tables2',
'maintenance_mode',
'reversion',
'phonenumber_field',
'django_prometheus',
'django_select2',
'templated_email',
'html2text',
'django_otp.plugins.otp_totp',
'django_otp.plugins.otp_static',
'django_otp',
'otp_yubikey',
'aleksis.core',
'allauth',
'allauth.account',
'allauth.socialaccount',
'invitations',
'health_check',
'health_check.db',
'health_check.cache',
'health_check.storage',
'health_check.contrib.psutil',
'health_check.contrib.migrations',
'dynamic_preferences',
'dynamic_preferences.users.apps.UserPreferencesConfig',
'impersonate',
'two_factor',
'two_factor.plugins.phonenumber',
'material',
'ckeditor',
'ckeditor_uploader',
'colorfield',
'django_bleach',
'favicon',
'django_filters',
'oauth2_provider',
'rest_framework',
'graphene_django',
'dj_iconify.apps.DjIconifyConfig',
'cachalot',
'django_cleanup.apps.CleanupConfig']
Installed Middleware:
['django_prometheus.middleware.PrometheusBeforeMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.http.ConditionalGetMiddleware',
'django.contrib.sites.middleware.CurrentSiteMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django_otp.middleware.OTPMiddleware',
'impersonate.middleware.ImpersonateMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'maintenance_mode.middleware.MaintenanceModeMiddleware',
'aleksis.core.util.middlewares.EnsurePersonMiddleware',
'django_prometheus.middleware.PrometheusAfterMiddleware']
Traceback (most recent call last):
File "/home/pinguin/.cache/pypoetry/virtualenvs/aleksis-core-VVtt0ddg-py3.11/lib/python3.11/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/home/pinguin/.cache/pypoetry/virtualenvs/aleksis-core-VVtt0ddg-py3.11/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/pinguin/.cache/pypoetry/virtualenvs/aleksis-core-VVtt0ddg-py3.11/lib/python3.11/site-packages/django/views/generic/base.py", line 103, in view
return self.dispatch(request, *args, **kwargs)
File "/home/pinguin/.cache/pypoetry/virtualenvs/aleksis-core-VVtt0ddg-py3.11/lib/python3.11/site-packages/django/utils/decorators.py", line 46, in _wrapper
return bound_method(*args, **kwargs)
File "/home/pinguin/.cache/pypoetry/virtualenvs/aleksis-core-VVtt0ddg-py3.11/lib/python3.11/site-packages/django/views/decorators/cache.py", line 62, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
File "/home/pinguin/.cache/pypoetry/virtualenvs/aleksis-core-VVtt0ddg-py3.11/lib/python3.11/site-packages/django/contrib/auth/mixins.py", line 109, in dispatch
return super().dispatch(request, *args, **kwargs)
File "/home/pinguin/.cache/pypoetry/virtualenvs/aleksis-core-VVtt0ddg-py3.11/lib/python3.11/site-packages/django/views/generic/base.py", line 142, in dispatch
return handler(request, *args, **kwargs)
File "/home/pinguin/.cache/pypoetry/virtualenvs/aleksis-core-VVtt0ddg-py3.11/lib/python3.11/site-packages/django/views/generic/edit.py", line 184, in post
return super().post(request, *args, **kwargs)
File "/home/pinguin/.cache/pypoetry/virtualenvs/aleksis-core-VVtt0ddg-py3.11/lib/python3.11/site-packages/django/views/generic/edit.py", line 152, in post
if form.is_valid():
File "/home/pinguin/.cache/pypoetry/virtualenvs/aleksis-core-VVtt0ddg-py3.11/lib/python3.11/site-packages/django/forms/forms.py", line 205, in is_valid
return self.is_bound and not self.errors
File "/home/pinguin/.cache/pypoetry/virtualenvs/aleksis-core-VVtt0ddg-py3.11/lib/python3.11/site-packages/django/forms/forms.py", line 200, in errors
self.full_clean()
File "/home/pinguin/.cache/pypoetry/virtualenvs/aleksis-core-VVtt0ddg-py3.11/lib/python3.11/site-packages/django/forms/forms.py", line 439, in full_clean
self._post_clean()
File "/home/pinguin/.cache/pypoetry/virtualenvs/aleksis-core-VVtt0ddg-py3.11/lib/python3.11/site-packages/django/forms/models.py", line 492, in _post_clean
self.instance.full_clean(exclude=exclude, validate_unique=False)
File "/home/pinguin/.cache/pypoetry/virtualenvs/aleksis-core-VVtt0ddg-py3.11/lib/python3.11/site-packages/django/db/models/base.py", line 1452, in full_clean
self.clean()
File "/home/pinguin/Projekte/Programmieren/AlekSIS/apps/official/AlekSIS-Core/aleksis/core/models.py", line 126, in clean
if self.date_end < self.date_start:
Exception Type: TypeError at /django/school_terms/create/
Exception Value: '<' not supported between instances of 'NoneType' and 'NoneType'