From 2d3681605e0f551f536fe071f6b50194329ef8a9 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Tue, 30 Aug 2022 22:24:35 -0700 Subject: [PATCH] backups: Use generic form template for create and schedule views Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- .../backups/templates/backups_form.html | 23 ------------------- .../backups/templates/backups_schedule.html | 21 ----------------- plinth/modules/backups/views.py | 7 ++++-- 3 files changed, 5 insertions(+), 46 deletions(-) delete mode 100644 plinth/modules/backups/templates/backups_form.html delete mode 100644 plinth/modules/backups/templates/backups_schedule.html diff --git a/plinth/modules/backups/templates/backups_form.html b/plinth/modules/backups/templates/backups_form.html deleted file mode 100644 index 2e08d5ebf..000000000 --- a/plinth/modules/backups/templates/backups_form.html +++ /dev/null @@ -1,23 +0,0 @@ -{% extends "base.html" %} -{% comment %} -# SPDX-License-Identifier: AGPL-3.0-or-later -{% endcomment %} - -{% load bootstrap %} -{% load i18n %} -{% load static %} - -{% block content %} - -

{{ title }}

- -
- {% csrf_token %} - - {{ form|bootstrap }} - - -
- -{% endblock %} diff --git a/plinth/modules/backups/templates/backups_schedule.html b/plinth/modules/backups/templates/backups_schedule.html deleted file mode 100644 index 475f9b8bf..000000000 --- a/plinth/modules/backups/templates/backups_schedule.html +++ /dev/null @@ -1,21 +0,0 @@ -{% extends "base.html" %} -{% comment %} -# SPDX-License-Identifier: AGPL-3.0-or-later -{% endcomment %} - -{% load bootstrap %} -{% load i18n %} -{% load static %} - -{% block content %} -

{{ title }}

- -
- {% csrf_token %} - - {{ form|bootstrap }} - - -
-{% endblock %} diff --git a/plinth/modules/backups/views.py b/plinth/modules/backups/views.py index 79b3cef19..d613e7b18 100644 --- a/plinth/modules/backups/views.py +++ b/plinth/modules/backups/views.py @@ -50,9 +50,11 @@ class BackupsView(AppView): class ScheduleView(SuccessMessageMixin, FormView): + """View to edit a backup schedule.""" + form_class = forms.ScheduleForm prefix = 'backups_schedule' - template_name = 'backups_schedule.html' + template_name = 'form.html' success_url = reverse_lazy('backups:index') success_message = gettext_lazy('Backup schedule updated.') @@ -101,9 +103,10 @@ class ScheduleView(SuccessMessageMixin, FormView): class CreateArchiveView(SuccessMessageMixin, FormView): """View to create a new archive.""" + form_class = forms.CreateArchiveForm prefix = 'backups' - template_name = 'backups_form.html' + template_name = 'form.html' success_url = reverse_lazy('backups:index') success_message = gettext_lazy('Archive created.')