mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-27 10:44:33 +00:00
backups: Provide a default backup name
Signed-off-by: James Valleroy <jvalleroy@mailbox.org> Reviewed-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
This commit is contained in:
parent
52ab0b54c6
commit
5cd1a1954c
@ -18,6 +18,7 @@
|
|||||||
Views for the backups app.
|
Views for the backups app.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from datetime import date
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.contrib.messages.views import SuccessMessageMixin
|
from django.contrib.messages.views import SuccessMessageMixin
|
||||||
from django.http import Http404
|
from django.http import Http404
|
||||||
@ -61,6 +62,12 @@ class CreateArchiveView(SuccessMessageMixin, FormView):
|
|||||||
context['title'] = _('Create Archive')
|
context['title'] = _('Create Archive')
|
||||||
return context
|
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):
|
def form_valid(self, form):
|
||||||
"""Create the archive on valid form submission."""
|
"""Create the archive on valid form submission."""
|
||||||
backups.create_archive(form.cleaned_data['name'],
|
backups.create_archive(form.cleaned_data['name'],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user