Example #1
0
 def edit_form(self):
     if self.request.method == 'POST':
         return ConfigurableDataSourceEditForm(self.domain,
                                               self.config,
                                               self.read_only,
                                               data=self.request.POST)
     return ConfigurableDataSourceEditForm(self.domain, self.config,
                                           self.read_only)
Example #2
0
def _edit_data_source_shared(request, domain, config, read_only=False):
    if request.method == 'POST':
        form = ConfigurableDataSourceEditForm(domain,
                                              config,
                                              read_only,
                                              data=request.POST)
        if form.is_valid():

            config = form.save(commit=True)
            messages.success(
                request,
                _(u'Data source "{}" saved!').format(config.display_name))

    else:
        form = ConfigurableDataSourceEditForm(domain, config, read_only)
    context = _shared_context(domain)
    context.update({
        'form': form,
        'data_source': config,
        'read_only': read_only
    })
    return render(request, "userreports/edit_data_source.html", context)