Don't require color for solid diaper change entries.

This commit is contained in:
Christopher Charbonneau Wells 2018-02-16 09:32:09 -05:00
parent d69667bbab
commit b972482cb1
2 changed files with 1 additions and 13 deletions

View File

@ -143,12 +143,6 @@ class DiaperChange(models.Model):
raise ValidationError(
'Wet and/or solid is required.', code='wet_or_solid')
# Color is required when Solid is selected.
if self.solid and not self.color:
raise ValidationError(
{'color': 'Color is required for solid diaper changes.'},
code='solid_color_required')
class Feeding(models.Model):
model_name = 'feeding'

View File

@ -67,15 +67,9 @@ class FormsTestCase(TestCase):
page = self.c.post('/changes/{}/'.format(entry.id), params)
self.assertEqual(page.status_code, 302)
params['solid'] = 0
params['color'] = ''
page = self.c.post('/changes/{}/'.format(entry.id), params)
self.assertEqual(page.status_code, 200)
self.assertFormError(page, 'form', 'color',
'Color is required for solid diaper changes.')
del params['solid']
del params['wet']
del params['color']
page = self.c.post('/changes/{}/'.format(entry.id), params)
self.assertEqual(page.status_code, 200)
self.assertFormError(page, 'form', None,