networks: Add page for network topology form

Signed-off-by: Nektarios Katakis <iam@nektarioskatakis.xyz>
[sunil: Use the term 'network topology' consistently]
[sunil: Properly title case the <h1> title]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Nektarios Katakis 2020-02-28 15:39:50 +00:00 committed by Sunil Mohan Adapa
parent 3b8308b0cf
commit e0e0a5dd60
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
4 changed files with 60 additions and 1 deletions

View File

@ -0,0 +1,21 @@
{% comment %}
# SPDX-License-Identifier: AGPL-3.0-or-later
{% endcomment %}
{% load bootstrap %}
{% load i18n %}
{% load static %}
<h1>
{% blocktrans trimmed %}
How is Your {{ box_name }} Connected to the Internet?
{% endblocktrans %}
</h1>
<p>
{% blocktrans trimmed %}
Select an option that best describes how your {{ box_name }} is connected in
your network. This information is used to guide you with further setup. It can
be changed later.
{% endblocktrans %}
</p>

View File

@ -0,0 +1,21 @@
{% extends "base.html" %}
{% comment %}
# SPDX-License-Identifier: AGPL-3.0-or-later
{% endcomment %}
{% load bootstrap %}
{% load i18n %}
{% load static %}
{% block content %}
{% include "network_topology_content.html" %}
<form class="form" method="post">
{% csrf_token %}
{{ form|bootstrap }}
<input type="submit" class="btn btn-primary" value="{% trans "Submit" %}"/>
</form>
{% endblock %}

View File

@ -37,4 +37,6 @@ urlpatterns = [
url(r'^sys/networks/firstboot/internet-connection-type/$',
views.InternetConnectionTypeFirstBootView.as_view(),
name='internet-connection-type-first-boot'),
url(r'^sys/networks/network-topology/$',
views.NetworkTopologyView.as_view(), name='network-topology'),
]

View File

@ -14,7 +14,7 @@ from plinth import kvstore, network
from plinth.modules import first_boot, networks
from .forms import (ConnectionTypeSelectForm, EthernetForm, GenericForm,
InternetConnectionTypeForm, PPPoEForm,
InternetConnectionTypeForm, NetworkTopologyForm, PPPoEForm,
RouterConfigurationForm, WifiForm)
logger = logging.getLogger(__name__)
@ -406,6 +406,21 @@ def delete(request, uuid):
})
class NetworkTopologyView(FormView):
"""View for local network topology form."""
template_name = 'network_topology_update.html'
form_class = NetworkTopologyForm
success_url = reverse_lazy('networks:index')
def get_initial(self):
"""Get initial form data."""
pass
def form_valid(self, form):
"""Save value to DB."""
return super().form_valid(form)
class RouterConfigurationView(FormView):
"""View for router configuration form."""
template_name = 'router_configuration_update.html'