Sunil Mohan Adapa b12d994760
upgrades: Separate concepts for backports enabled vs. requested
It is confusing to combine the user's intent of wanting to have backports
activated with whether they have actually been configured in the system.

- Separate out checking for requested which is a key in the kvstore from enabled
which is about checking system configuration for backports.

- Implement convenience method for setting whether user requested backports.

- Do not base the status display (in security and upgrades modules) on the
configuration status and instead focus on user intent.

  - If user requested backports but they have not been enabled yet due to not
  being available, show as activated. System will keep trying the background and
  configure eventually.

  - If user requested backports but their configuration is outdated yet due to
  newer release, show as activated. System will keep trying in the background
  and configure latest settings eventually.

- In all places where backports enabling is being checked, split the logic for
'can be activated' from 'already activated' and 'user requested activation'
properly.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2020-09-11 10:55:10 -04:00

22 lines
729 B
Python

# SPDX-License-Identifier: AGPL-3.0-or-later
"""
Forms for configuring unattended-upgrades.
"""
from django import forms
from django.utils.translation import ugettext_lazy as _
class ConfigureForm(forms.Form):
"""Configuration form to enable/disable automatic upgrades."""
auto_upgrades_enabled = forms.BooleanField(
label=_('Enable auto-update'), required=False, help_text=_(
'When enabled, FreedomBox automatically updates once a day.'))
class BackportsFirstbootForm(forms.Form):
"""Form to configure backports during first boot wizard."""
backports_enabled = forms.BooleanField(
label=_('Activate frequent feature updates (recommended)'),
required=False, initial=True)