changed form for c-lab and gastro pin to allow 4-8 digits instead of 4-6
This commit is contained in:
parent
30e9b85be1
commit
839e5c7749
1 changed files with 5 additions and 4 deletions
|
|
@ -35,9 +35,9 @@ class GastroPinField(forms.CharField):
|
||||||
"""
|
"""
|
||||||
Check if the value is all numeric and 4 - 6 chars long.
|
Check if the value is all numeric and 4 - 6 chars long.
|
||||||
"""
|
"""
|
||||||
match = re.match(r'^\d{4,6}$', value)
|
match = re.match(r'^\d{4,8}$', value)
|
||||||
if not match:
|
if not match:
|
||||||
raise forms.ValidationError(_('PIN must be 4 to 6 digits.'))
|
raise forms.ValidationError(_('PIN must be 4 to 8 digits.'))
|
||||||
|
|
||||||
|
|
||||||
class GastroPinForm(forms.Form):
|
class GastroPinForm(forms.Form):
|
||||||
|
|
@ -47,7 +47,8 @@ class GastroPinForm(forms.Form):
|
||||||
def clean(self):
|
def clean(self):
|
||||||
cleaned_data = super(GastroPinForm, self).clean()
|
cleaned_data = super(GastroPinForm, self).clean()
|
||||||
gastropin1 = cleaned_data.get("gastropin1")
|
gastropin1 = cleaned_data.get("gastropin1")
|
||||||
gastropin2 = cleaned_data.get("gastropin2")
|
gastropin2 = cleaned_data.get("gastropin2",
|
||||||
|
help_text=_('Numerical only, 4 to 8 digits'))
|
||||||
if gastropin1 != gastropin2:
|
if gastropin1 != gastropin2:
|
||||||
raise forms.ValidationError(
|
raise forms.ValidationError(
|
||||||
_('The PINs entered were not identical.'),
|
_('The PINs entered were not identical.'),
|
||||||
|
|
@ -122,7 +123,7 @@ class NRF24Form(forms.Form):
|
||||||
class CLabPinForm(forms.Form):
|
class CLabPinForm(forms.Form):
|
||||||
c_lab_pin1 = GastroPinField(label=_('New c-lab PIN'))
|
c_lab_pin1 = GastroPinField(label=_('New c-lab PIN'))
|
||||||
c_lab_pin2 = GastroPinField(label=_('Repeat c-lab PIN'),
|
c_lab_pin2 = GastroPinField(label=_('Repeat c-lab PIN'),
|
||||||
help_text=_('Numerical only, 4 to 6 digits'))
|
help_text=_('Numerical only, 4 to 8 digits'))
|
||||||
|
|
||||||
|
|
||||||
class AdminForm(forms.Form):
|
class AdminForm(forms.Form):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue