diff options
author | rubenwardy <rw@rubenwardy.com> | 2018-11-14 00:56:28 +0000 |
---|---|---|
committer | rubenwardy <rw@rubenwardy.com> | 2018-11-14 00:56:28 +0000 |
commit | 8ca343768944fc8d9b2af9147697d2d6d960c064 (patch) | |
tree | 582e7dd93f949a58105baaa7071d44da78f13688 /app | |
parent | aeafb8247f1977fd2ca44e15612ba8c20d7ab908 (diff) | |
download | cheatdb-8ca343768944fc8d9b2af9147697d2d6d960c064.tar.xz |
Revert "Add flask-admin"
This reverts commit dd6257a0a042f1ae82bcd00c999fade3746abdbf.
Diffstat (limited to 'app')
-rw-r--r-- | app/templates/admin/list.html | 3 | ||||
-rw-r--r-- | app/views/admin.py | 36 |
2 files changed, 3 insertions, 36 deletions
diff --git a/app/templates/admin/list.html b/app/templates/admin/list.html index 307821f..a2ac6d5 100644 --- a/app/templates/admin/list.html +++ b/app/templates/admin/list.html @@ -1,12 +1,11 @@ {% extends "base.html" %} {% block title %} -Admin + Admin Tools {% endblock %} {% block content %} <ul> - <li><a href="db/">Database</a></li> <li><a href="{{ url_for('user_list_page') }}">User list</a></li> <li><a href="{{ url_for('tag_list_page') }}">Tag Editor</a></li> <li><a href="{{ url_for('license_list_page') }}">License Editor</a></li> diff --git a/app/views/admin.py b/app/views/admin.py index 19bcd4b..029d4c9 100644 --- a/app/views/admin.py +++ b/app/views/admin.py @@ -27,37 +27,6 @@ from flask_wtf import FlaskForm from wtforms import * from app.utils import loginUser, rank_required, triggerNotif import datetime -from flask_admin import Admin -from flask_admin.contrib.sqla import ModelView - -class MyModelView(ModelView): - def is_accessible(self): - return current_user.is_authenticated and current_user.rank.atLeast(UserRank.ADMIN) - - def inaccessible_callback(self, name, **kwargs): - # redirect to login page if user doesn't have access - if current_user.is_authenticated: - abort(403) - else: - return redirect(url_for('user.login', next=request.url)) - -admin = Admin(app, name='ContentDB', template_mode='bootstrap3', url="/admin/db") -admin.add_view(MyModelView(User, db.session)) -admin.add_view(MyModelView(Package, db.session)) -admin.add_view(MyModelView(Dependency, db.session)) -admin.add_view(MyModelView(EditRequest, db.session)) -admin.add_view(MyModelView(EditRequestChange, db.session)) -admin.add_view(MyModelView(ForumTopic, db.session)) -admin.add_view(MyModelView(License, db.session)) -admin.add_view(MyModelView(MetaPackage, db.session)) -admin.add_view(MyModelView(Notification, db.session)) -admin.add_view(MyModelView(PackageRelease, db.session)) -admin.add_view(MyModelView(PackageScreenshot, db.session)) -admin.add_view(MyModelView(Tag, db.session)) -admin.add_view(MyModelView(Thread, db.session)) -admin.add_view(MyModelView(ThreadReply, db.session)) -admin.add_view(MyModelView(UserEmailVerification, db.session)) - @app.route("/admin/", methods=["GET", "POST"]) @rank_required(UserRank.ADMIN) @@ -110,8 +79,8 @@ def admin_page(): rel = PackageRelease() rel.package = package - rel.title = datetime.date.today().isoformat() - rel.url = "" + rel.title = datetime.date.today().isoformat() + rel.url = "" rel.task_id = uuid() rel.approved = True db.session.add(rel) @@ -129,7 +98,6 @@ def admin_page(): deleted_packages = Package.query.filter_by(soft_deleted=True).all() return render_template("admin/list.html", deleted_packages=deleted_packages) - class SwitchUserForm(FlaskForm): username = StringField("Username") submit = SubmitField("Switch") |