From 839e5c77499bb93b2e89c5136d0698d6401635a2 Mon Sep 17 00:00:00 2001 From: Uwe Kamper Date: Tue, 29 Oct 2013 22:28:30 +0100 Subject: [PATCH] changed form for c-lab and gastro pin to allow 4-8 digits instead of 4-6 --- account/forms.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/account/forms.py b/account/forms.py index 6f957eb..4860106 100644 --- a/account/forms.py +++ b/account/forms.py @@ -35,9 +35,9 @@ class GastroPinField(forms.CharField): """ 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: - raise forms.ValidationError(_('PIN must be 4 to 6 digits.')) + raise forms.ValidationError(_('PIN must be 4 to 8 digits.')) class GastroPinForm(forms.Form): @@ -47,7 +47,8 @@ class GastroPinForm(forms.Form): def clean(self): cleaned_data = super(GastroPinForm, self).clean() 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: raise forms.ValidationError( _('The PINs entered were not identical.'), @@ -122,7 +123,7 @@ class NRF24Form(forms.Form): class CLabPinForm(forms.Form): c_lab_pin1 = GastroPinField(label=_('New 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):