Merge tag 'emptyuserform' into develop
empty user form field hotfix
This commit is contained in:
@@ -19,7 +19,7 @@ import sqlalchemy as sa
|
|||||||
from sqlite3 import OperationalError
|
from sqlite3 import OperationalError
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
import datetime
|
import datetime
|
||||||
|
from django.core.exceptions import ValidationError
|
||||||
from rowers.rows import validate_file_extension
|
from rowers.rows import validate_file_extension
|
||||||
|
|
||||||
from rowsandall_app.settings import (
|
from rowsandall_app.settings import (
|
||||||
@@ -574,24 +574,35 @@ class RowerPowerZonesForm(ModelForm):
|
|||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
cleaned_data = super(RowerPowerZonesForm, self).clean()
|
cleaned_data = super(RowerPowerZonesForm, self).clean()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
pw_ut2 = cleaned_data['pw_ut2']
|
pw_ut2 = cleaned_data['pw_ut2']
|
||||||
|
except KeyError:
|
||||||
|
raise ValidationError("Value cannot be empty")
|
||||||
except:
|
except:
|
||||||
pw_ut2 = int(self.data['pw_ut2'])
|
pw_ut2 = int(self.data['pw_ut2'])
|
||||||
try:
|
try:
|
||||||
pw_ut1 = cleaned_data['pw_ut1']
|
pw_ut1 = cleaned_data['pw_ut1']
|
||||||
|
except KeyError:
|
||||||
|
raise ValidationError("Value cannot be empty")
|
||||||
except:
|
except:
|
||||||
pw_ut1 = int(self.data['pw_ut1'])
|
pw_ut1 = int(self.data['pw_ut1'])
|
||||||
try:
|
try:
|
||||||
pw_at = cleaned_data['pw_at']
|
pw_at = cleaned_data['pw_at']
|
||||||
|
except KeyError:
|
||||||
|
raise ValidationError("Value cannot be empty")
|
||||||
except:
|
except:
|
||||||
pw_at = int(self.data['pw_at'])
|
pw_at = int(self.data['pw_at'])
|
||||||
try:
|
try:
|
||||||
pw_tr = cleaned_data['pw_tr']
|
pw_tr = cleaned_data['pw_tr']
|
||||||
|
except KeyError:
|
||||||
|
raise ValidationError("Value cannot be empty")
|
||||||
except:
|
except:
|
||||||
pw_tr = int(self.data['pw_tr'])
|
pw_tr = int(self.data['pw_tr'])
|
||||||
try:
|
try:
|
||||||
pw_an = cleaned_data['pw_an']
|
pw_an = cleaned_data['pw_an']
|
||||||
|
except KeyError:
|
||||||
|
raise ValidationError("Value cannot be empty")
|
||||||
except:
|
except:
|
||||||
pw_an = int(self.data['pw_an'])
|
pw_an = int(self.data['pw_an'])
|
||||||
|
|
||||||
@@ -627,6 +638,38 @@ class RowerPowerZonesForm(ModelForm):
|
|||||||
cleaned_data['ut1name'] = 'AN'
|
cleaned_data['ut1name'] = 'AN'
|
||||||
|
|
||||||
|
|
||||||
|
try:
|
||||||
|
ut3name = cleaned_data['ut3name']
|
||||||
|
except:
|
||||||
|
ut2name = 'UT3'
|
||||||
|
cleaned_data['ut3name'] = 'UT3'
|
||||||
|
try:
|
||||||
|
ut2name = cleaned_data['ut2name']
|
||||||
|
except:
|
||||||
|
ut2name = 'UT2'
|
||||||
|
cleaned_data['ut2name'] = 'UT2'
|
||||||
|
try:
|
||||||
|
ut1name = cleaned_data['ut1name']
|
||||||
|
except:
|
||||||
|
ut1name = 'UT1'
|
||||||
|
cleaned_data['ut1name'] = 'UT1'
|
||||||
|
try:
|
||||||
|
atname = cleaned_data['atname']
|
||||||
|
except:
|
||||||
|
atname = 'AT'
|
||||||
|
cleaned_data['atname'] = 'AT'
|
||||||
|
try:
|
||||||
|
trname = cleaned_data['trname']
|
||||||
|
except:
|
||||||
|
trname = 'TR'
|
||||||
|
cleaned_data['ut1name'] = 'TR'
|
||||||
|
try:
|
||||||
|
anname = cleaned_data['anname']
|
||||||
|
except:
|
||||||
|
anname = 'AN'
|
||||||
|
cleaned_data['ut1name'] = 'AN'
|
||||||
|
|
||||||
|
|
||||||
if pw_ut1 <= pw_ut2:
|
if pw_ut1 <= pw_ut2:
|
||||||
e = "{ut1name} should be higher than {ut2name}".format(
|
e = "{ut1name} should be higher than {ut2name}".format(
|
||||||
ut1name = ut1name,
|
ut1name = ut1name,
|
||||||
|
|||||||
Reference in New Issue
Block a user