Joseph Nuthalapati 9ab0e13ab9
snapshots: Refactoring and indentation changes
- Made updating snapshot configuration more efficient by running a single
  snapper command instead of one per configuration.
- Set default configuration for NUMBER_LIMIT only once at the time of
  installation. Snapshot version has been incremented to support this.

Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com>
2018-03-09 13:42:54 +05:30

58 lines
2.2 KiB
Python

#
# This file is part of FreedomBox.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
"""
Forms for snapshot module.
"""
from django import forms
from django.utils.translation import ugettext_lazy as _
class SnapshotForm(forms.Form):
enable_timeline_snapshots = forms.ChoiceField(
label=_('Timeline Snapshots'),
help_text=_('Enable or disable timeline snapshots '
'(hourly, daily, monthly and yearly).'),
choices=[('yes', 'Enabled'), ('no', 'Disabled')])
hourly_limit = forms.IntegerField(
label=_('Hourly Snapshots Limit'), min_value=0,
help_text=_('Keep a maximum of this many hourly snapshots.'))
daily_limit = forms.IntegerField(
label=_('Daily Snapshots Limit'), min_value=0,
help_text=_('Keep a maximum of this many daily snapshots.'))
weekly_limit = forms.IntegerField(
label=_('Weekly Snapshots Limit'), min_value=0,
help_text=_('Keep a maximum of this many weekly snapshots.'))
monthly_limit = forms.IntegerField(
label=_('Monthly Snapshots Limit'), min_value=0,
help_text=_('Keep a maximum of this many monthly snapshots.'))
yearly_limit = forms.IntegerField(
label=_('Yearly Snapshots Limit'), min_value=0, help_text=_(
'Keep a maximum of this many yearly snapshots. '
'The default is 0 (disabled).'))
number_min_age = forms.IntegerField(
label=_('Delete Software Snapshots older than (days)'), min_value=0,
help_text=_(
'Software snapshots older than this will be deleted. '
'This does not limit the number of software snapshots created.'))