mirror of
https://github.com/ferdzo/iotDashboard.git
synced 2026-04-05 09:06:26 +00:00
Refactor big.
This commit is contained in:
@@ -5,9 +5,11 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{% if form.instance.pk %}Edit{% else %}Add{% endif %} Device</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body class="bg-light">
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="#">IoT Dashboard</a>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||
@@ -16,7 +18,7 @@
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'chart' %}">Chart</a>
|
||||
<a class="nav-link" href="{% url 'index' %}">Chart</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'device_list' %}">Devices</a>
|
||||
@@ -36,14 +38,29 @@
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container mt-5">
|
||||
<h1 class="text-center mb-4">{% if form.instance.pk %}Edit{% else %}Add{% endif %} Device</h1>
|
||||
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<div class="mb-3">
|
||||
<!-- Display the form fields -->
|
||||
{{ form.as_p }}
|
||||
|
||||
<!-- If there are errors, display them -->
|
||||
{% if form.errors %}
|
||||
<div class="alert alert-danger">
|
||||
<ul>
|
||||
{% for field, errors in form.errors.items %}
|
||||
<li>{{ field }}: {{ errors|join:", " }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<!-- Submit and Cancel buttons -->
|
||||
<button type="submit" class="btn btn-success">Save</button>
|
||||
<a href="{% url 'device_list' %}" class="btn btn-secondary">Cancel</a>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user