def config_dhis2_repeater(request, domain, repeater_id): repeater = Dhis2Repeater.get(repeater_id) assert repeater.domain == domain, f'"{repeater.domain}" != "{domain}"' if request.method == 'POST': form = Dhis2ConfigForm(data=request.POST) if form.is_valid(): data = form.cleaned_data repeater.dhis2_config.form_configs = list( map(Dhis2FormConfig.wrap, data['form_configs'])) repeater.save() else: form_configs = json.dumps([ form_config.to_json() for form_config in repeater.dhis2_config.form_configs ]) form = Dhis2ConfigForm(data={ 'form_configs': form_configs, }) return render(request, 'dhis2/edit_config.html', { 'domain': domain, 'repeater_id': repeater_id, 'form': form })
def repeater(self): repeater = Dhis2Repeater.get(self.repeater_id) assert repeater.domain == self.domain return repeater
def repeater(self): repeater = Dhis2Repeater.get(self.repeater_id) assert repeater.domain == self.domain return repeater