diff --git a/plinth/modules/networks/__init__.py b/plinth/modules/networks/__init__.py index 5879a4513..fcca30165 100644 --- a/plinth/modules/networks/__init__.py +++ b/plinth/modules/networks/__init__.py @@ -54,6 +54,8 @@ manual_page = 'Networks' app = None +ROUTER_CONFIGURATION_TYPE_KEY = 'networks_router_configuration_type' + class NetworksApp(app_module.App): """FreedomBox app for Networks.""" diff --git a/plinth/modules/networks/forms.py b/plinth/modules/networks/forms.py index e3647d74e..a460f5a47 100644 --- a/plinth/modules/networks/forms.py +++ b/plinth/modules/networks/forms.py @@ -306,7 +306,6 @@ class RouterConfigurationWizardForm(forms.Form): future suggestions during the setup process and other apps. """ router_config = forms.ChoiceField( - initial='dmz', label=_('Preferred router configuration'), choices=[ ( diff --git a/plinth/modules/networks/networks.py b/plinth/modules/networks/networks.py index 0adc732c5..937fc68af 100644 --- a/plinth/modules/networks/networks.py +++ b/plinth/modules/networks/networks.py @@ -15,7 +15,7 @@ # along with this program. If not, see . # -from logging import Logger +import logging from django.contrib import messages from django.shortcuts import redirect @@ -24,13 +24,13 @@ from django.urls import reverse_lazy from django.utils.translation import ugettext as _ from django.views.decorators.http import require_POST -from plinth import network +from plinth import network, kvstore from plinth.modules import networks, first_boot from .forms import (ConnectionTypeSelectForm, EthernetForm, GenericForm, PPPoEForm, WifiForm, RouterConfigurationWizardForm) -logger = Logger(__name__) +logger = logging.getLogger(__name__) def index(request): @@ -426,7 +426,15 @@ def router_configuration_help_page(request): is_firstboot = True \ if 'firstboot' in request.build_absolute_uri() else False - if request.method == "POST": + if request.method == 'POST' and request.POST['router_config']: + form = RouterConfigurationWizardForm(request.POST) + if form.is_valid(): + logger.info('Updating router configuration setup with value: %s' % + request.POST['router_config']) + kvstore.set( + networks.ROUTER_CONFIGURATION_TYPE_KEY, + request.POST['router_config'] + ) if is_firstboot: resp = reverse_lazy(first_boot.next_step()) else: