From 4dd1035cf3204ec084a4441db992d235b6ae644a Mon Sep 17 00:00:00 2001 From: Nektarios Katakis Date: Sat, 29 Feb 2020 05:36:20 +0000 Subject: [PATCH] networks: First boot view for network topology wizard Signed-off-by: Nektarios Katakis [sunil: Use the term 'network topology' consistently] Signed-off-by: Sunil Mohan Adapa Reviewed-by: Sunil Mohan Adapa --- .../templates/network_topology_firstboot.html | 24 +++++++++++++++++++ plinth/modules/networks/views.py | 17 +++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 plinth/modules/networks/templates/network_topology_firstboot.html diff --git a/plinth/modules/networks/templates/network_topology_firstboot.html b/plinth/modules/networks/templates/network_topology_firstboot.html new file mode 100644 index 000000000..4c3eafbb0 --- /dev/null +++ b/plinth/modules/networks/templates/network_topology_firstboot.html @@ -0,0 +1,24 @@ +{% extends "base_firstboot.html" %} +{% comment %} +# SPDX-License-Identifier: AGPL-3.0-or-later +{% endcomment %} + +{% load bootstrap %} +{% load i18n %} +{% load static %} + +{% block content %} + {% include "network_topology_content.html" %} + +
+ {% csrf_token %} + + {{ form|bootstrap }} + + + +
+ +{% endblock %} diff --git a/plinth/modules/networks/views.py b/plinth/modules/networks/views.py index 0b7ca5fd5..3a0472777 100644 --- a/plinth/modules/networks/views.py +++ b/plinth/modules/networks/views.py @@ -421,6 +421,23 @@ class NetworkTopologyView(FormView): return super().form_valid(form) +class NetworkTopologyFirstBootView(NetworkTopologyView): + """View for network topology form during first wizard.""" + template_name = 'network_topology_firstboot.html' + + def get_success_url(self): + """Return next fistboot step.""" + return reverse_lazy(first_boot.next_step()) + + def form_valid(self, form): + """Mark the first wizard step as done, save value and redirect.""" + first_boot.mark_step_done('network_topology_wizard') + if 'skip' in form.data: + return FormView.form_valid(self, form) + + return super().form_valid(form) + + class RouterConfigurationView(FormView): """View for router configuration form.""" template_name = 'router_configuration_update.html'