From df5edbc1cc0975e6a135cc1e9f2c579af0c120da Mon Sep 17 00:00:00 2001 From: lois <lois@procolix.eu> Date: Tue, 25 Mar 2025 16:54:40 +0100 Subject: [PATCH] Fix merge issue --- panel/src/panel/templates/configuration_form.html | 2 +- panel/src/panel/tests/test_configuration_form.py | 5 +++-- panel/src/panel/urls.py | 1 + panel/src/panel/views.py | 8 -------- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/panel/src/panel/templates/configuration_form.html b/panel/src/panel/templates/configuration_form.html index 31a0e864..ffc78e3d 100644 --- a/panel/src/panel/templates/configuration_form.html +++ b/panel/src/panel/templates/configuration_form.html @@ -1,6 +1,6 @@ {% extends "base.html" %} {% block content %} -<form method="post" enctype="multipart/form-data" action="{% url 'configuration_form' %}"> +<form method="post" enctype="multipart/form-data" action="{% url 'save' %}"> {% csrf_token %} {{ form.as_p }} diff --git a/panel/src/panel/tests/test_configuration_form.py b/panel/src/panel/tests/test_configuration_form.py index a96d8441..805b0e34 100644 --- a/panel/src/panel/tests/test_configuration_form.py +++ b/panel/src/panel/tests/test_configuration_form.py @@ -13,7 +13,7 @@ class ConfigurationForm(TestCase): password=self.password ) - self.config_url = reverse('configuration_form') + self.config_url = reverse('save') def test_configuration_form_submission(self): config = Configuration.objects.create( @@ -36,12 +36,13 @@ class ConfigurationForm(TestCase): enable=True, mastodon_enable=True, ) - + print(form_data) response = self.client.post(self.config_url, data=form_data) self.assertEqual(response.status_code, 302) config.refresh_from_db() + print(config.parsed_value) self.assertTrue(config.parsed_value.enable) self.assertTrue(config.parsed_value.mastodon.enable) # this should not have changed diff --git a/panel/src/panel/urls.py b/panel/src/panel/urls.py index 7865bad9..011a2843 100644 --- a/panel/src/panel/urls.py +++ b/panel/src/panel/urls.py @@ -27,4 +27,5 @@ urlpatterns = [ path("services/", views.ServiceList.as_view(), name='service_list'), path("configuration/", views.ConfigurationForm.as_view(), name='configuration_form'), path("deployment/status/", views.DeploymentStatus.as_view(), name='deployment_status'), + path("save/", views.Save.as_view(), name='save'), ] diff --git a/panel/src/panel/views.py b/panel/src/panel/views.py index c867074c..6e45df92 100644 --- a/panel/src/panel/views.py +++ b/panel/src/panel/views.py @@ -90,14 +90,6 @@ class Save(ConfigurationForm): return super().form_valid(form) -class DeploymentStatus(ConfigurationForm): - def form_valid(self, form): - obj = self.get_object() - obj.value = form.to_python().model_dump_json() - obj.save() - - return super().form_valid(form) - class DeploymentStatus(ConfigurationForm): def form_valid(self, form): obj = self.get_object()