backups: Use generic form template for create and schedule views

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2022-08-30 22:24:35 -07:00 committed by James Valleroy
parent 5935ce89a6
commit 2d3681605e
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
3 changed files with 5 additions and 46 deletions

View File

@ -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 %}
<h3>{{ title }}</h3>
<form class="form" method="post">
{% csrf_token %}
{{ form|bootstrap }}
<input type="submit" class="btn btn-primary"
value="{% trans "Submit" %}"/>
</form>
{% endblock %}

View File

@ -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 %}
<h2>{{ title }}</h2>
<form class="form" method="post">
{% csrf_token %}
{{ form|bootstrap }}
<input type="submit" class="btn btn-primary"
value="{% trans 'Submit' %}" />
</form>
{% endblock %}

View File

@ -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.')