mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
networks: Save networks topology type to DB
Signed-off-by: Nektarios Katakis <iam@nektarioskatakis.xyz> [sunil: Use the term 'network topology' consistently] Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
5fd3e95bdf
commit
2a00b186ea
@ -47,6 +47,7 @@ logger = Logger(__name__)
|
|||||||
|
|
||||||
app = None
|
app = None
|
||||||
|
|
||||||
|
NETWORK_TOPOLOGY_TYPE_KEY = 'networks_topology_type'
|
||||||
ROUTER_CONFIGURATION_TYPE_KEY = 'networks_router_configuration_type'
|
ROUTER_CONFIGURATION_TYPE_KEY = 'networks_router_configuration_type'
|
||||||
INTERNET_CONNECTION_TYPE_KEY = 'networks_internet_type'
|
INTERNET_CONNECTION_TYPE_KEY = 'networks_internet_type'
|
||||||
|
|
||||||
|
|||||||
@ -414,10 +414,18 @@ class NetworkTopologyView(FormView):
|
|||||||
|
|
||||||
def get_initial(self):
|
def get_initial(self):
|
||||||
"""Get initial form data."""
|
"""Get initial form data."""
|
||||||
pass
|
return {
|
||||||
|
'network_topology':
|
||||||
|
kvstore.get_default(networks.NETWORK_TOPOLOGY_TYPE_KEY,
|
||||||
|
'to_router')
|
||||||
|
}
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
"""Save value to DB."""
|
"""Save value to DB."""
|
||||||
|
network_topology = form.cleaned_data['network_topology']
|
||||||
|
logger.info('Updating network topology type with value %s' %
|
||||||
|
network_topology)
|
||||||
|
kvstore.set(networks.NETWORK_TOPOLOGY_TYPE_KEY, network_topology)
|
||||||
return super().form_valid(form)
|
return super().form_valid(form)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user