Sunil Mohan Adapa 74214c18ae
*: Use Django gettext functions instead of ugettext
- ugettext functions will be removed in Django 4.0. Each use emits a warning
when running with Django 3.2. Since we have warnings enabled in developer mode,
we see quite a few messages because of this.

- ugettext is already a simple alias of gettext. So, no regressions are
expected.

Tests:

- Accessing an affected app in UI with Django 3.2 and Django 2.2 works fine.

- Using Django 3.2 there are no warnings related to removal of ugettext
functions.

- Ran regular unit tests.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2021-09-20 16:50:16 -04:00

51 lines
2.1 KiB
Python

# SPDX-License-Identifier: AGPL-3.0-or-later
"""
Forms for snapshot module.
"""
from django import forms
from django.utils.translation import gettext_lazy as _
class SnapshotForm(forms.Form):
free_space = forms.ChoiceField(
label=_('Free Disk Space to Maintain'),
help_text=_('Maintain this percentage of free space on the disk. '
'If free space falls below this value, older snapshots '
'are removed until this much free space is regained. The '
'default value is 30%.'),
choices=[(i / 100, '{}%'.format(i)) for i in range(10, 80, 10)])
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'))])
enable_software_snapshots = forms.ChoiceField(
label=_('Software Installation Snapshots'),
help_text=_('Enable or disable snapshots before and after software '
'installation'), 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 value is 0 (keep no yearly snapshot).'))