hack to have only one template
This commit is contained in:
parent
79616bb8d2
commit
9c8bc00e8d
13
app.py
13
app.py
@ -135,11 +135,18 @@ def admin_edit(link_id):
|
|||||||
@app.route('/admin/add')
|
@app.route('/admin/add')
|
||||||
@auth.login_required
|
@auth.login_required
|
||||||
def admin_add():
|
def admin_add():
|
||||||
add_form = EditForm()
|
edit_form = EditForm()
|
||||||
add_form.folder.choices = [('', '')] + [(query.id, query.name) for query in AnimeFolder.query.all()]
|
edit_form.folder.choices = [('', '')] + [(query.id, query.name) for query in AnimeFolder.query.all()]
|
||||||
titles = AnimeTitle.query.all()
|
titles = AnimeTitle.query.all()
|
||||||
|
link = AnimeLink()
|
||||||
|
for attr in dir(link):
|
||||||
|
if not attr.startswith('_'):
|
||||||
|
try:
|
||||||
|
setattr(link, attr, '')
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
return render_template('admin/add.html', search_form=SearchForm(), titles=titles, add_form=add_form)
|
return render_template('admin/edit.html', search_form=SearchForm(), link=link, titles=titles, edit_form=edit_form)
|
||||||
|
|
||||||
|
|
||||||
@app.route('/admin/save', methods=['POST'])
|
@app.route('/admin/save', methods=['POST'])
|
||||||
|
@ -1,91 +0,0 @@
|
|||||||
{% extends "layout.html" %}
|
|
||||||
{% block title %} - Admin Add{% endblock %}
|
|
||||||
{% block body %}
|
|
||||||
<form method="post" action="{{ url_for('admin_save') }}">
|
|
||||||
{{ add_form.csrf_token }}
|
|
||||||
{{ add_form.id }}
|
|
||||||
|
|
||||||
<div class="field is-horizontal">
|
|
||||||
<div class="field-body">
|
|
||||||
<div class="field column">
|
|
||||||
<div class="control is-expanded">
|
|
||||||
<div class="select is-fullwidth">
|
|
||||||
{{ add_form.folder }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="field column is-6">
|
|
||||||
<div class="control is-expanded">
|
|
||||||
<div class="select is-fullwidth">
|
|
||||||
{{ add_form.name(list='animes', class='input', placeholder='Name') }}
|
|
||||||
<datalist id="animes">
|
|
||||||
{% for title in titles %}
|
|
||||||
<option>
|
|
||||||
{{ title.name }}
|
|
||||||
</option>
|
|
||||||
{% endfor %}
|
|
||||||
</datalist>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="field is-horizontal">
|
|
||||||
<div class="field-body">
|
|
||||||
<div class="field column is-4">
|
|
||||||
<div class="control is-expanded">
|
|
||||||
{{ add_form.link(class='input', placeholder='Link') }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="field column">
|
|
||||||
<div class="control is-expanded">
|
|
||||||
{{ add_form.season(class='input', placeholder='Season') }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="field is-horizontal">
|
|
||||||
<div class="field-body">
|
|
||||||
<div class="field column is-5">
|
|
||||||
<div class="control is-expanded">
|
|
||||||
{{ add_form.comment(class='input', placeholder='Comment') }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="field column">
|
|
||||||
<div class="control is-expanded">
|
|
||||||
<div class="select is-fullwidth">
|
|
||||||
{{ add_form.keyword(list='keywords', class='input', placeholder='Keyword') }}
|
|
||||||
<datalist id="keywords">
|
|
||||||
{% for title in titles %}
|
|
||||||
<option>
|
|
||||||
{{ title.keyword }}
|
|
||||||
</option>
|
|
||||||
{% endfor %}
|
|
||||||
</datalist>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<label class="checkbox">
|
|
||||||
<b>{{ true|flagify }}</b>
|
|
||||||
{{ add_form.is_vf }}
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="field is-horizontal">
|
|
||||||
<div class="field-body">
|
|
||||||
<div class="field column">
|
|
||||||
<div class="control is-expanded">
|
|
||||||
<input class="button is-info" type="submit" onclick="this.disabled=true;this.form.submit()">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
{% endblock %}
|
|
@ -52,14 +52,13 @@
|
|||||||
<div class="field-body">
|
<div class="field-body">
|
||||||
<div class="field column is-5">
|
<div class="field column is-5">
|
||||||
<div class="control is-expanded">
|
<div class="control is-expanded">
|
||||||
<div class="select is-fullwidth">
|
|
||||||
{{ edit_form.comment(value=link.comment, class='input', placeholder='Comment') }}
|
{{ edit_form.comment(value=link.comment, class='input', placeholder='Comment') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="field column">
|
<div class="field column">
|
||||||
<div class="control is-expanded">
|
<div class="control is-expanded">
|
||||||
|
<div class="select is-fullwidth">
|
||||||
{{ edit_form.keyword(value=link.title.keyword, list='keywords', class='input', placeholder='Keyword') }}
|
{{ edit_form.keyword(value=link.title.keyword, list='keywords', class='input', placeholder='Keyword') }}
|
||||||
<datalist id="keywords">
|
<datalist id="keywords">
|
||||||
{% for title in titles %}
|
{% for title in titles %}
|
||||||
@ -70,6 +69,7 @@
|
|||||||
</datalist>
|
</datalist>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<label class="checkbox">
|
<label class="checkbox">
|
||||||
<b>{{ true|flagify }}</b>
|
<b>{{ true|flagify }}</b>
|
||||||
|
Reference in New Issue
Block a user