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

Remove ente_add page

This commit is contained in:
Steffo 2017-09-18 16:18:47 +02:00 committed by Stefano Pigozzi
parent cb05b5963b
commit b121e2a248
3 changed files with 10 additions and 19 deletions

View file

@ -264,7 +264,7 @@ def page_ente_add():
if 'username' not in session:
return abort(403)
if request.method == 'GET':
return render_template("ente/add.htm", pagetype="ente", user=session.get("username"))
return render_template("ente/show.htm", action="add", pagetype="ente", user=session.get("username"))
else:
nuovoent = Ente(request.form['nomeente'], request.form['nomebreveente'])
db.session.add(nuovoent)
@ -305,7 +305,7 @@ def page_ente_show(eid):
return abort(403)
if request.method == "GET":
ente = Ente.query.get_or_404(eid)
return render_template("ente/show.htm", ente=ente, user=session.get("username"))
return render_template("ente/show.htm", action="show", ente=ente, user=session.get("username"))
else:
ente = Ente.query.get_or_404(eid)
ente.nomeente = request.form["nomeente"]

View file

@ -1,12 +0,0 @@
{% extends "base.htm" %}
{% block title %}Aggiungi ente • estus{% endblock %}
{% block content %}
<h1>
Aggiungi nuovo ente
</h1>
<form class="form-inline" action="/ente_add" method="post">
<input class="form-control" type="text" placeholder="Nome ente" name="nomeente">
<input class="form-control" type="text" placeholder="Nome breve" name="nomebreveente">
<input class="btn btn-primary" type="submit">
</form>
{% endblock %}

View file

@ -2,12 +2,15 @@
{% block title %}Modifica ente • estus{% endblock %}
{% block content %}
<h1>
Modifica ente
{% if action == "add" %}
Crea ente
{% elif action == "show" %}
Modifica ente
{% endif %}
</h1>
<form class="form-inline" action="/ente_show/{{ ente.eid }}" method="post">
<input class="form-control" type="text" placeholder="Nome ente" name="nomeente" value="{{ ente.nomeente }}">
<input class="form-control" type="text" placeholder="Nome breve" name="nomebreveente"
value="{{ ente.nomebreveente }}">
<form class="form-inline" {% if ente %}action="/ente_show/{{ ente.eid }}"{% endif %} method="post">
<input class="form-control" type="text" placeholder="Nome ente" name="nomeente" {% if ente %}value="{{ ente.nomeente }}"{% endif %}>
<input class="form-control" type="text" placeholder="Nome breve" name="nomebreveente" {% if ente %}value="{{ ente.nomebreveente }}"{% endif %}>
<input class="btn btn-primary" type="submit">
</form>
{% endblock %}