mirror of https://github.com/snachodog/mybuddy.git
Don't require color for solid diaper change entries.
This commit is contained in:
parent
d69667bbab
commit
b972482cb1
|
@ -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'
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue