1
Fork 0
mirror of https://github.com/Steffo99/estus.git synced 2024-11-21 23:24:18 +00:00

Add Modifica button in each details page

This commit is contained in:
Lorenzo 2017-09-13 08:19:08 +02:00
parent ee6fdb2855
commit af00feaa76
8 changed files with 42 additions and 4 deletions

View file

@ -99,10 +99,11 @@ class Dispositivo(db.Model):
inv_ente = db.Column(db.String)
fornitore = db.Column(db.String)
seriale = db.Column(db.String)
ip = db.Column(db.String)
nid = db.Column(db.Integer, db.ForeignKey('reti.nid'))
rete = db.relationship("Rete", backref='dispositivi')
def __init__(self, tipo, marca, modello, inv_ced, inv_ente, fornitore, nid, seriale):
def __init__(self, tipo, marca, modello, inv_ced, inv_ente, fornitore, nid, seriale, ip):
self.tipo = tipo
self.marca = marca
self.modello = modello
@ -111,6 +112,7 @@ class Dispositivo(db.Model):
self.fornitore = fornitore
self.nid = nid
self.seriale = seriale
self.ip=ip
def __repr__(self):
return "<Dispositivo {}>".format(self.inv_ced)
@ -457,7 +459,7 @@ def page_disp_add():
return render_template("error.htm", error="Il campo Inventario ente deve contenere un numero.")
nuovodisp = Dispositivo(request.form['tipo'], request.form['marca'], request.form['modello'],
request.form['inv_ced'], request.form['inv_ente'], request.form['fornitore'],
request.form['rete'], request.form['seriale'])
request.form['rete'], request.form['seriale'], request.form['ip'])
db.session.add(nuovodisp)
db.session.commit()
# Trova tutti gli utenti, edizione sporco hack in html
@ -551,6 +553,7 @@ def page_disp_show(did):
disp.inv_ente = request.form['inv_ente']
disp.fornitore = request.form['fornitore']
disp.nid = int(request.form['rete'])
disp.ip = request.form['ip']
# Trova tutti gli utenti, edizione sporco hack in html
users = list()
while True:

View file

@ -26,6 +26,11 @@
padding-right: 10px;
}
.container-lower
{
margin-top: 10px;
}
body
{
padding-top: 70px; /*Per la navbar*/

View file

@ -11,7 +11,7 @@
<div class="container">
{% block content %}{% endblock %}
</div>
<div class="container">
<div class="container container-lower">
<div class="well well-sm">
<div align="right">
<img class="goldfish" src="{{ url_for('static', filename='goldfish.png') }}">

View file

@ -94,6 +94,12 @@
</select>
</div>
</div>
<div class="form-group">
<label class="col-xs-2" for="form-ip">Indirizzo IP</label>
<div class="col-xs-10">
<input id="form-seriale" class="form-control" type="text" placeholder="IP" name="ip">
</div>
</div>
<div class="form-group">
<label class="col-xs-2" for="form-control"></label>
<div class="col-xs-10">

View file

@ -79,5 +79,18 @@
<a href="/net_details/{{ disp.rete.nid }}"><code>{{ disp.rete.nome }} - {{ disp.rete.network_ip }}/{{ disp.rete.subnet }}</code></a>
</div>
</li>
<li class="list-group-item">
<h4 class="list-group-item-heading">
Indirizzo IP
</h4>
<div class="list-group-item-text">
<code>{{ disp.ip }}</code>
</div>
</li>
<a href="/disp_show/{{ disp.did }}">
<button type="button" class="btn btn-primary">
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Modifica
</button>
</a>
</ul>
{% endblock %}

View file

@ -108,5 +108,11 @@
<input class="form-control btn btn-primary" type="submit">
</div>
</div>
<div class="form-group">
<label class="col-xs-2" for="form-ip">Fornitore</label>
<div class="col-xs-10">
<input id="form-ip" class="form-control" type="text" placeholder="Indirizzo IP" name="ip" value="{{ dispositivo.ip }}">
</div>
</div>
</form>
{% endblock %}

View file

@ -31,7 +31,7 @@
</li>
</ul>
<a href="/imp_show/{{ imp.iid }}">
<button type="button" class="btn btn-default btn-lg">
<button type="button" class="btn btn-primary">
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Modifica
</button>
</a>

View file

@ -39,5 +39,10 @@
{% endfor %}
</div>
</li>
<a href="/net_show/{{ net.nid }}">
<button type="button" class="btn btn-primary">
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> Modifica
</button>
</a>
</ul>
{% endblock %}