Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base Templating of Pages #4

Merged
merged 3 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions NetworkMapper/ip/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ class Meta:
def __init__(self, *args, vlan_options=None, wifi_options=None, **kwargs):
super(ClientDeviceForm, self).__init__(*args, **kwargs)

empty_choice = [("", "None")]
self.fields["vlan"].widget = forms.Select(choices=vlan_options, attrs={"class": "form-control"})

self.fields["vlan"].widget = forms.Select(choices=empty_choice + vlan_options, attrs={"class": "form-control"})
self.fields["vlan"].required = False
empty_choice = [("", "None")]

self.fields["wifi"].widget = forms.Select(choices=empty_choice + wifi_options, attrs={"class": "form-control"})
self.fields["wifi"].required = False
14 changes: 14 additions & 0 deletions NetworkMapper/ip/templates/base/master.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}{% endblock %}</title>
</head>
<body>

{% block content %}
{% endblock %}

</body>
</html>
20 changes: 10 additions & 10 deletions NetworkMapper/ip/templates/ip/device/create.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Create Device</title>
</head>
<body>
{% extends "../../base/master.html" %}


{% block title %}
Create Device
{% endblock %}


{% block content %}

<h1>Create Device</h1>

Expand All @@ -17,5 +18,4 @@ <h1>Create Device</h1>

<a href="{% url 'device.index' %}">Back to Device List</a>

</body>
</html>
{% endblock %}
20 changes: 10 additions & 10 deletions NetworkMapper/ip/templates/ip/device/edit.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Edit Device</title>
</head>
<body>
{% extends "../../base/master.html" %}


{% block title %}
Edit Device
{% endblock %}


{% block content %}

<h1>Edit Device - {{ device.name }}</h1>

Expand All @@ -15,5 +16,4 @@ <h1>Edit Device - {{ device.name }}</h1>
<button type="submit">Save Changes</button>
</form>

</body>
</html>
{% endblock %}
20 changes: 10 additions & 10 deletions NetworkMapper/ip/templates/ip/device/index.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Device List</title>
</head>
<body>
{% extends "../../base/master.html" %}


{% block title %}
Device List
{% endblock %}


{% block content %}

<a href="{% url 'device.create' %}">Create Device</a>

Expand Down Expand Up @@ -42,5 +43,4 @@ <h1>Device List</h1>
</tbody>
</table>

</body>
</html>
{% endblock %}
20 changes: 10 additions & 10 deletions NetworkMapper/ip/templates/ip/vlan/create.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Create VLAN</title>
</head>
<body>
{% extends "../../base/master.html" %}


{% block title %}
Create VLAN
{% endblock %}


{% block content %}

<h1>Create VLAN</h1>

Expand All @@ -17,5 +18,4 @@ <h1>Create VLAN</h1>

<a href="{% url 'vlan.index' %}">Back to VLAN List</a>

</body>
</html>
{% endblock %}
22 changes: 11 additions & 11 deletions NetworkMapper/ip/templates/ip/vlan/edit.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Edit VLAN</title>
</head>
<body>
{% extends "../../base/master.html" %}

<h1>Edit VLAN - {{ vlan.vlan_id }}</h1>

{% block title %}
Edit VLAN
{% endblock %}


{% block content %}

<h1>Edit VLAN - {{ vlan.name }}</h1>

<form method="post" action="{% url 'vlan.edit' vlan.vlan_id %}">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Save Changes</button>
</form>

</body>
</html>
{% endblock %}
20 changes: 10 additions & 10 deletions NetworkMapper/ip/templates/ip/vlan/index.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>VLAN List</title>
</head>
<body>
{% extends "../../base/master.html" %}


{% block title %}
VLAN List
{% endblock %}


{% block content %}

<a href="{% url 'vlan.create' %}">Create VLAN</a>

Expand Down Expand Up @@ -38,5 +39,4 @@ <h1>VLAN List</h1>
</tbody>
</table>

</body>
</html>
{% endblock %}
20 changes: 10 additions & 10 deletions NetworkMapper/ip/templates/ip/wifi/create.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Create WIFI Network</title>
</head>
<body>
{% extends "../../base/master.html" %}


{% block title %}
Create WIFI Network
{% endblock %}


{% block content %}

<h1>Create WIFI Network</h1>

Expand All @@ -17,5 +18,4 @@ <h1>Create WIFI Network</h1>

<a href="{% url 'wifi.index' %}">Back to WIFI Network List</a>

</body>
</html>
{% endblock %}
20 changes: 10 additions & 10 deletions NetworkMapper/ip/templates/ip/wifi/edit.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Edit WIFI Network</title>
</head>
<body>
{% extends "../../base/master.html" %}


{% block title %}
Edit WIFI Network - {{ wifi.ssid }}
{% endblock %}


{% block content %}

<h1>Edit WIFI Network - {{ wifi.ssid }}</h1>

Expand All @@ -15,5 +16,4 @@ <h1>Edit WIFI Network - {{ wifi.ssid }}</h1>
<button type="submit">Save Changes</button>
</form>

</body>
</html>
{% endblock %}
20 changes: 10 additions & 10 deletions NetworkMapper/ip/templates/ip/wifi/index.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WIFI List</title>
</head>
<body>
{% extends "../../base/master.html" %}


{% block title %}
WiFi List
{% endblock %}


{% block content %}

<a href="{% url 'wifi.create' %}">Create WIFI Network</a>

Expand Down Expand Up @@ -34,5 +35,4 @@ <h1>WIFI List</h1>
</tbody>
</table>

</body>
</html>
{% endblock %}