0003-manager-allow-dynamic-fields-in-cell-edit-form-49175.patch
combo/manager/views.py | ||
---|---|---|
546 | 546 |
def form_valid(self, form): |
547 | 547 |
if self.request.is_ajax(): |
548 | 548 |
self.object = form.save() |
549 |
form = self.get_form_class()(instance=self.object) |
|
549 | 550 |
response = self.form_invalid(form) # avoid redirection |
550 | 551 |
else: |
551 | 552 |
response = super(PageEditCellView, self).form_valid(form) |
tests/test_dataviz.py | ||
---|---|---|
973 | 973 |
assert cell.filter_params == {} |
974 | 974 | |
975 | 975 | |
976 |
@with_httmock(new_api_mock) |
|
977 |
def test_chartng_cell_manager_new_api_dynamic_fields(app, admin_user, new_api_statistics): |
|
978 |
page = Page.objects.create(title='One', slug='index') |
|
979 |
cell = ChartNgCell.objects.create(page=page, order=1, placeholder='content') |
|
980 |
statistic = Statistic.objects.get(slug='one-serie') |
|
981 | ||
982 |
app = login(app) |
|
983 |
resp = app.get('/manage/pages/%s/' % page.id) |
|
984 |
field_prefix = 'cdataviz_chartngcell-%s-' % cell.id |
|
985 |
resp.form[field_prefix + 'statistic'] = statistic.pk |
|
986 |
resp = app.post(resp.form.action, params=resp.form.submit_fields(), xhr=True) |
|
987 |
assert 'time_interval' in resp.text |
|
988 | ||
989 | ||
976 | 990 |
@with_httmock(bijoe_mock) |
977 | 991 |
def test_table_cell(app, admin_user, statistics): |
978 | 992 |
page = Page(title='One', slug='index') |
979 |
- |