Skip to content

Commit

Permalink
Don't require color for solid diaper change entries.
Browse files Browse the repository at this point in the history
  • Loading branch information
cdubz committed Feb 16, 2018
1 parent d69667b commit b972482
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
6 changes: 0 additions & 6 deletions core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,6 @@ def clean(self):
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'
Expand Down
8 changes: 1 addition & 7 deletions core/tests/tests_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,9 @@ def test_diaperchange_forms(self):
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,
Expand Down

0 comments on commit b972482

Please sign in to comment.