1
Fork 0
mirror of https://github.com/Steffo99/estus.git synced 2024-11-25 17:14:19 +00:00

Add Serial Field in Dispositivo table

This commit is contained in:
Lorenzo 2017-09-11 17:05:45 +02:00
parent 508b428c30
commit b4a8db8f17
4 changed files with 28 additions and 3 deletions

View file

@ -86,8 +86,9 @@ class Dispositivo(db.Model):
fornitore = db.Column(db.String(64)) fornitore = db.Column(db.String(64))
nid = db.Column(db.Integer, db.ForeignKey('network.nid')) nid = db.Column(db.Integer, db.ForeignKey('network.nid'))
rete = db.relationship("Network", backref='dispositivo') rete = db.relationship("Network", backref='dispositivo')
seriale = db.Column(db.String(30))
def __init__(self, tipo, marca, modello, inv_ced, inv_ente, fornitore, nid): def __init__(self, tipo, marca, modello, inv_ced, inv_ente, fornitore, nid, seriale):
self.tipo = tipo self.tipo = tipo
self.marca = marca self.marca = marca
self.modello = modello self.modello = modello
@ -95,6 +96,7 @@ class Dispositivo(db.Model):
self.inv_ente = inv_ente self.inv_ente = inv_ente
self.fornitore = fornitore self.fornitore = fornitore
self.nid = nid self.nid = nid
self.seriale = seriale
def __repr__(self): def __repr__(self):
return "<Dispositivo {}>".format(self.inv_ced) return "<Dispositivo {}>".format(self.inv_ced)
@ -379,7 +381,7 @@ def page_disp_add():
user=session["username"]) user=session["username"])
else: else:
nuovodisp = Dispositivo(request.form['tipo'], request.form['marca'], request.form['modello'], 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['inv_ced'], request.form['inv_ente'], request.form['fornitore'], request.form['rete'], request.form['seriale'])
db.session.add(nuovodisp) db.session.add(nuovodisp)
db.session.commit() db.session.commit()
# Trova tutti gli utenti, edizione sporco hack in html # Trova tutti gli utenti, edizione sporco hack in html

View file

@ -78,6 +78,12 @@
<input id="form-fornitore" class="form-control" type="text" placeholder="Fornitore" name="fornitore"> <input id="form-fornitore" class="form-control" type="text" placeholder="Fornitore" name="fornitore">
</div> </div>
</div> </div>
<div class="form-group">
<label class="col-xs-2" for="form-seriale">Numero Seriale</label>
<div class="col-xs-10">
<input id="form-seriale" class="form-control" type="text" placeholder="Seriale" name="seriale">
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="col-xs-2" for="">Rete</label> <label class="col-xs-2" for="">Rete</label>
<div class="col-xs-10"> <div class="col-xs-10">

View file

@ -63,5 +63,21 @@
<code>{{ disp.inv_ente }}</code> <code>{{ disp.inv_ente }}</code>
</div> </div>
</li> </li>
<li class="list-group-item">
<h4 class="list-group-item-heading">
Codice Seriale
</h4>
<div class="list-group-item-text">
<code>{{ disp.seriale }}</code>
</div>
</li>
<li class="list-group-item">
<h4 class="list-group-item-heading">
Network
</h4>
<div class="list-group-item-text">
<a href="/net_details/{{ disp.rete.nid }}>"<code>{{ disp.rete.nome }} - {{ disp.rete.ip }}</code></a>
</div>
</li>
</ul> </ul>
{% endblock %} {% endblock %}

View file

@ -13,6 +13,7 @@
<th>Marca</th> <th>Marca</th>
<th>Modello</th> <th>Modello</th>
<th>Fornitore</th> <th>Fornitore</th>
<th>Seriale</th>
<th>Ispeziona</th> <th>Ispeziona</th>
<th>Elimina</th> <th>Elimina</th>
</tr> </tr>
@ -26,7 +27,7 @@
<td>{{ d[0].dispositivo.marca }}</td> <td>{{ d[0].dispositivo.marca }}</td>
<td>{{ d[0].dispositivo.modello }}</td> <td>{{ d[0].dispositivo.modello }}</td>
<td>{{ d[0].dispositivo.fornitore }}</td> <td>{{ d[0].dispositivo.fornitore }}</td>
<td>{{ d[0].dispositivo.rete.nome }}</td> <td>{{ d[0].dispositivo.seriale }}</td>
<td><a href="/disp_details/{{ d[0].did }}"><span class="glyphicon glyphicon-list-alt"></span></a></td> <td><a href="/disp_details/{{ d[0].did }}"><span class="glyphicon glyphicon-list-alt"></span></a></td>
<td><a href="/disp_del/{{ d[0].did }}"><span class="glyphicon glyphicon-remove"></span></a></td> <td><a href="/disp_del/{{ d[0].did }}"><span class="glyphicon glyphicon-remove"></span></a></td>
</tr> </tr>