def config_basic(request): if request.method == 'POST': form = BasicConfigForm(data=request.POST) if form.is_valid(): form.save() messages.info(request, _("Settings updated!")) return redirect(request.GET.get("next", request.get_full_path())) else: form = BasicConfigForm() return render(request, 'spirit/admin/config/config_basic.html', {'form': form, })
def test_basic_config(self): """ basic conf edition """ form_data = {"site_name": "foo", "site_description": "", "template_footer": ""} form = BasicConfigForm(data=form_data) self.assertEqual(form.is_valid(), True) form_data = {"site_name": "foo", "site_description": "bar", "template_footer": "foobar"} form = BasicConfigForm(data=form_data) self.assertEqual(form.is_valid(), True)