1
0
Fork 0

Fix merge issue

This commit is contained in:
lois Verheij 2025-03-25 16:54:40 +01:00
parent 550d08cad6
commit df5edbc1cc
4 changed files with 5 additions and 11 deletions

View file

@ -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 }}

View file

@ -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

View file

@ -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'),
]

View file

@ -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()