From 798e08d74bea6d09641e49747b322772f1e7f0b8 Mon Sep 17 00:00:00 2001 From: Midgard Date: Sun, 26 Jan 2020 14:35:14 +0100 Subject: [PATCH] Remove removed concepts in admin, add choice item --- app/admin.py | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/app/admin.py b/app/admin.py index 75166f1..0ba2810 100644 --- a/app/admin.py +++ b/app/admin.py @@ -6,7 +6,7 @@ from flask_admin import Admin from flask_admin.contrib.sqla import ModelView from flask_sqlalchemy import SQLAlchemy -from models import Location, Order, OrderItem, Product, User +from models import Order, OrderItem, OrderItemChoice, User class ModelBaseView(ModelView): @@ -26,27 +26,11 @@ class UserAdminModel(ModelBaseView): inline_models = None -class ProductAdminModel(ModelBaseView): - "Model for product admin" - # pylint: disable=R0903 - column_searchable_list = ("name",) - inline_models = None - - -class LocationAdminModel(ModelBaseView): - "Model for location admin" - # pylint: disable=R0903 - column_searchable_list = ("name", "address", "website") - inline_models = None - form_columns = ("name", "address", "website", "telephone") - - def init_admin(app: Flask, database: SQLAlchemy) -> None: "Initialize the admin related things in the app." admin = Admin(app, name="Haldis", url="/admin", template_mode="bootstrap3") admin.add_view(UserAdminModel(User, database.session)) - admin.add_view(LocationAdminModel(Location, database.session)) - admin.add_view(ProductAdminModel(Product, database.session)) admin.add_view(ModelBaseView(Order, database.session)) admin.add_view(ModelBaseView(OrderItem, database.session)) + admin.add_view(ModelBaseView(OrderItemChoice, database.session))