fix: add GridWidget
and form.set_grid()
for convenience
omg how did i not do this sooner
This commit is contained in:
parent
f68fe26ada
commit
40562c126e
8 changed files with 117 additions and 17 deletions
|
@ -142,6 +142,20 @@ class TestForm(TestCase):
|
|||
self.assertIs(form.widgets['foo'], new_widget)
|
||||
self.assertIs(schema['foo'].widget, new_widget)
|
||||
|
||||
def test_set_grid(self):
|
||||
form = self.make_form(fields=['foo', 'bar'])
|
||||
self.assertNotIn('foo', form.widgets)
|
||||
self.assertNotIn('foogrid', form.grid_vue_context)
|
||||
|
||||
grid = Grid(self.request, key='foogrid',
|
||||
columns=['a', 'b'],
|
||||
data=[{'a': 1, 'b': 2}, {'a': 3, 'b': 4}])
|
||||
|
||||
form.set_grid('foo', grid)
|
||||
self.assertIn('foo', form.widgets)
|
||||
self.assertIsInstance(form.widgets['foo'], widgets.GridWidget)
|
||||
self.assertIn('foogrid', form.grid_vue_context)
|
||||
|
||||
def test_set_validator(self):
|
||||
form = self.make_form(fields=['foo', 'bar'])
|
||||
self.assertEqual(form.validators, {})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue