# Improves form date checking
* adds validator to make sure no dates like `01.01.1` can be accepted. All dates must be somewhat later than 01.01.1950
This commit is contained in:
@@ -9,6 +9,7 @@ from dal import autocomplete
|
||||
from django import forms
|
||||
|
||||
from konova.forms.base_form import BaseForm
|
||||
from konova.utils import validators
|
||||
from konova.utils.message_templates import EDITED_GENERAL_DATA
|
||||
from user.models import User
|
||||
from django.db import transaction
|
||||
@@ -175,6 +176,7 @@ class NewInterventionForm(BaseForm):
|
||||
label=_("Registration date"),
|
||||
label_suffix=_(""),
|
||||
required=False,
|
||||
validators=[validators.reasonable_date],
|
||||
widget=forms.DateInput(
|
||||
attrs={
|
||||
"type": "date",
|
||||
@@ -187,6 +189,7 @@ class NewInterventionForm(BaseForm):
|
||||
label=_("Binding on"),
|
||||
label_suffix=_(""),
|
||||
required=False,
|
||||
validators=[validators.reasonable_date],
|
||||
widget=forms.DateInput(
|
||||
attrs={
|
||||
"type": "date",
|
||||
|
||||
@@ -11,6 +11,7 @@ from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from intervention.models import RevocationDocument
|
||||
from konova.forms.modals import BaseModalForm, RemoveModalForm
|
||||
from konova.utils import validators
|
||||
from konova.utils.message_templates import REVOCATION_ADDED, REVOCATION_EDITED
|
||||
|
||||
|
||||
@@ -19,6 +20,7 @@ class NewRevocationModalForm(BaseModalForm):
|
||||
label=_("Date"),
|
||||
label_suffix=_(""),
|
||||
help_text=_("Date of revocation"),
|
||||
validators=[validators.reasonable_date],
|
||||
widget=forms.DateInput(
|
||||
attrs={
|
||||
"type": "date",
|
||||
|
||||
Reference in New Issue
Block a user