From 2cf2b3d0c0fb5e3914e595f1da3339b905c1484c Mon Sep 17 00:00:00 2001 From: pi3c Date: Thu, 21 Sep 2023 22:44:25 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B2=D0=BE=D0=B4=20?= =?UTF-8?q?=D0=BC=D0=BE=D0=B4=D0=B5=D0=BB=D0=B5=D0=B9=20=D0=B0=D0=B4=D0=BC?= =?UTF-8?q?=D0=B8=D0=BD=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pyproger/admin/views.py | 54 +++++++++++++++++++++++++++++++---------- pyproger/app.py | 36 ++++++++++++++++++++++++--- 2 files changed, 73 insertions(+), 17 deletions(-) diff --git a/pyproger/admin/views.py b/pyproger/admin/views.py index 41b4f09..f335660 100644 --- a/pyproger/admin/views.py +++ b/pyproger/admin/views.py @@ -34,6 +34,24 @@ class UserView(MyAdminView): "active", "roles", ) + column_labels = dict( + first_name="Имя", + last_name="Фамилия", + posts="Посты", + roles="Роли", + email="Эл. почта", + username="Ник", + password="Хэш пароля", + active="Активирован", + confirmed_at="Подтвержден", + last_login_at="Последний login", + current_login_at="Текущий login", + last_login_ip="Последний ip", + current_login_ip="Текущий ip", + login_count="Кол-во входов", + create_datetime="Дата создания", + update_datetime="Дата обновления", + ) class RoleView(MyAdminView): @@ -41,25 +59,35 @@ class RoleView(MyAdminView): "name", "description", ) + column_labels = dict(name="Название", description="Описание") class TagView(MyAdminView): - pass + column_labels = dict(tag="Тэг") class PostView(MyAdminView): - # # form_excluded_columns = ("author", "create_datetime", "update_datetime") - # column_list = ( - # "title", - # "published", - # ) - # column_labels = dict( - # tags="Tags", - # title="Title", - # author="Author", - # published="Published", - # published_datetime="Pubdate", - # ) + # form_excluded_columns = ( + # "author", + # "create_datetime", + # "update_datetime", + # "text", + # ) + column_list = ( + "title", + "published", + "tags", + ) + column_labels = dict( + tags="Тэги", + slug="Слаг", + title="Заголовок", + author="Автор", + published="Опубликовано", + create_datetime="Дата создания", + update_datetime="Дата обновления", + text="Текст", + ) # override form type with CKEditorField form_overrides = dict(text=CKEditorField) diff --git a/pyproger/app.py b/pyproger/app.py index 75c5429..862a023 100644 --- a/pyproger/app.py +++ b/pyproger/app.py @@ -39,10 +39,38 @@ def create_app(test_config=None): from pyproger.admin.views import PostView, RoleView, TagView, UserView - admin.add_view(RoleView(Role, db.session, category="Пользователи")) - admin.add_view(UserView(User, db.session, category="Пользователи")) - admin.add_view(TagView(Tag, db.session, category="Посты")) - admin.add_view(PostView(Post, db.session, category="Посты")) + admin.add_view( + RoleView( + Role, + db.session, + category="Пользователи", + name="Роли", + ) + ) + admin.add_view( + UserView( + User, + db.session, + category="Пользователи", + name="Юзеры", + ) + ) + admin.add_view( + TagView( + Tag, + db.session, + category="Посты", + name="Тэги постов", + ) + ) + admin.add_view( + PostView( + Post, + db.session, + category="Посты", + name="Посты", + ) + ) from pyproger.cli.commands import bp_cli