def get_form_config(self, request): ConfigForm.serie_fields = self.get_serie_fields() ConfigForm.chart_types = self.chart_types form = ConfigForm(data=request.GET or None) if hasattr(self, 'list_serie_ops'): op_choices = [] for item in form.fields['serie_op'].choices: if item[0] in self.list_serie_ops: op_choices.append(item) if op_choices: form.fields['serie_op'].choices = list(op_choices) form.is_valid() return form
def get_form_config(self, request): ConfigForm.serie_fields = self.get_serie_fields() ConfigForm.chart_types = self.chart_types form = ConfigForm(data=request.GET or None) form.is_valid() return form