Commit 92e20df9 authored by James Valleroy's avatar James Valleroy

backups: Provide a default backup name

Signed-off-by: James Valleroy's avatarJames Valleroy <jvalleroy@mailbox.org>
parent 7715f68a
......@@ -18,6 +18,7 @@
Views for the backups app.
"""
from datetime import date
from django.contrib import messages
from django.contrib.messages.views import SuccessMessageMixin
from django.http import Http404
......@@ -61,6 +62,12 @@ class CreateArchiveView(SuccessMessageMixin, FormView):
context['title'] = _('Create Archive')
return context
def get_initial(self):
"""Return the initial data to use for forms on this view."""
initial = super().get_initial()
initial['name'] = 'FreedomBox_backup_' + str(date.today())
return initial
def form_valid(self, form):
"""Create the archive on valid form submission."""
backups.create_archive(form.cleaned_data['name'],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment