Improve order and order item admin views

This commit is contained in:
Midgard 2020-07-29 23:26:07 +02:00
parent f6753172ec
commit 7464ee4ea4
Signed by: midgard
GPG key ID: 511C112F1331BBB4

View file

@ -23,19 +23,26 @@ class UserAdminModel(ModelBaseView):
class OrderAdminModel(ModelBaseView):
# pylint: disable=too-few-public-methods
column_default_sort = ("starttime", True)
column_list = ["starttime", "stoptime", "location_name", "location_id", "courier"]
column_labels = {
"starttime": "Start time", "stoptime": "Closing time",
"location_name": "Location name", "location_id": "HLDS location ID",
"courier": "Courier"}
"starttime": "Start Time", "stoptime": "Closing Time",
"location_id": "HLDS Location ID"}
form_excluded_columns = ["items", "courier_id"]
column_default_sort = ("starttime", True)
can_delete = False
class OrderItemAdminModel(ModelBaseView):
# pylint: disable=too-few-public-methods
column_default_sort = ("order_id", True)
column_list = [
"order_id", "order.location_name", "user_name", "user", "dish_name", "dish_id", "comment", "price", "paid",
"hlds_data_version"
]
column_labels = {
"order_id": "Order", "order.location_name": "Order's Location",
"user_name": "Anon. User", "user_id": "Registered User",
"hlds_data_version": "HLDS Data Version", "dish_id": "HLDS Dish ID"}
def init_admin(app: Flask, database: SQLAlchemy) -> None: