diff --git a/app.py b/app.py index fd0fa55..0c5fecc 100644 --- a/app.py +++ b/app.py @@ -135,11 +135,18 @@ def admin_edit(link_id): @app.route('/admin/add') @auth.login_required def admin_add(): - add_form = EditForm() - add_form.folder.choices = [('', '')] + [(query.id, query.name) for query in AnimeFolder.query.all()] + edit_form = EditForm() + edit_form.folder.choices = [('', '')] + [(query.id, query.name) for query in AnimeFolder.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']) diff --git a/templates/admin/add.html b/templates/admin/add.html deleted file mode 100644 index b2e1435..0000000 --- a/templates/admin/add.html +++ /dev/null @@ -1,91 +0,0 @@ -{% extends "layout.html" %} -{% block title %} - Admin Add{% endblock %} -{% block body %} -
- {{ add_form.csrf_token }} - {{ add_form.id }} - -
-
-
-
-
- {{ add_form.folder }} -
-
-
- -
-
-
- {{ add_form.name(list='animes', class='input', placeholder='Name') }} - - {% for title in titles %} - - {% endfor %} - -
-
-
-
-
- -
-
-
-
- {{ add_form.link(class='input', placeholder='Link') }} -
-
- -
-
- {{ add_form.season(class='input', placeholder='Season') }} -
-
-
-
- -
-
-
-
- {{ add_form.comment(class='input', placeholder='Comment') }} -
-
- -
-
-
- {{ add_form.keyword(list='keywords', class='input', placeholder='Keyword') }} - - {% for title in titles %} - - {% endfor %} - -
-
-
- - -
-
- -
-
-
-
- -
-
-
-
-
-{% endblock %} diff --git a/templates/admin/edit.html b/templates/admin/edit.html index 21c728a..0e08acd 100644 --- a/templates/admin/edit.html +++ b/templates/admin/edit.html @@ -52,22 +52,22 @@
-
- {{ edit_form.comment(value=link.comment, class='input', placeholder='Comment') }} -
+ {{ edit_form.comment(value=link.comment, class='input', placeholder='Comment') }}
- {{ edit_form.keyword(value=link.title.keyword, list='keywords', class='input', placeholder='Keyword') }} - - {% for title in titles %} - - {% endfor %} - +
+ {{ edit_form.keyword(value=link.title.keyword, list='keywords', class='input', placeholder='Keyword') }} + + {% for title in titles %} + + {% endfor %} + +