flask adminlte
1.0.0
flask-admin 1.5.2 および flask-security 3.0.0 を使用して flask フレームワークに適合した Bootstrap AdminLTE テンプレート。
これは、フラスコで書かれたバックエンド用の美しく使いやすい管理パネルを開発するのに役立ちます。
http://adminlte.najdaapps.com/admin/
ログイン: [email protected]
パスワード:管理者
ディレクトリadminlte 、 static 、 templatesプロジェクトにコピーします。
from flask import Flask , url_for
from flask_security import Security
from flask_admin import helpers as admin_helpers
from adminlte . admin import AdminLte , admins_store
app = Flask ( __name__ )
security = Security ( app , admins_store )
admin = AdminLte ( app , skin = 'green' , name = 'FlaskCMS' , short_name = "<b>F</b>C" , long_name = "<b>Flask</b>CMS" )
@ security . context_processor
def security_context_processor ():
return dict (
admin_base_template = admin . base_template ,
admin_view = admin . index_view ,
h = admin_helpers ,
get_url = url_for
) class DeviceView ( BaseAdminView ):
column_editable_list = [ 'name' , 'type' , 'rooted' ]
column_searchable_list = [ 'name' , 'type' , 'rooted' ]
column_exclude_list = None
column_details_exclude_list = None
column_filters = [ 'name' , 'type' , 'rooted' ]
can_export = True
can_view_details = False
can_create = True
can_edit = True
can_delete = True
edit_modal = True
create_modal = True
details_modal = False
admin . add_view ( DeviceView ( Device , db . session , name = "Devices" , menu_icon_value = 'fa-laptop' )) admin . add_link ( FaLink ( name = 'Website' , url = 'http://tomasznajda.com' , icon_value = 'fa-globe' , target = "_blank" )) admin . add_view ( DeviceView ( Device , db . session , name = "Devices" , category = 'Author' , menu_icon_value = 'fa-laptop' ))
admin . add_link ( FaLink ( name = 'Website' , category = 'Author' , url = 'http://tomasznajda.com' , icon_value = 'fa-globe' , target = "_blank" ))
admin . set_category_icon ( name = 'Author' , icon_type = 'fa' , icon_value = 'fa-address-card' )app -> Flaskアプリケーションオブジェクトname -> 例: FlaskCMS 。アプリケーション名。ページタイトルとして表示されます。デフォルトは「管理者」short_name -> 例: <b>F</b>C 。短いアプリケーション名。折りたたまれたメニューバーに表示されます。デフォルトでは、name プロパティの値が使用されます。long_name -> 例: <b>Flask</b>CMS 。長いアプリケーション名。展開されたメニュー バーと各セキュリティ フォームの上に表示されます。デフォルトでは、name プロパティの値が使用されます。skin -> AdminLTE スキンの色 ( blue 、 black 、 puprle 、 green 、 red 、 yellow black-light blue-light purple-light 、 green-light 、 red-light 、 yellow-light )。デフォルトでは、 blueが使用されます。url -> ベース URLsubdomain -> 使用するサブドメインindex_view -> 使用するホームページ ビュー。デフォルトはAdminIndexViewです。translations_path -> 翻訳メッセージ カタログの場所。デフォルトでは、Flask-Admin に同梱されている翻訳が使用されます。endpoint -> インデックス ビューのベース エンドポイント名。単一の Flask アプリケーションでAdminクラスの複数のインスタンスを使用する場合は、インスタンスごとに一意のエンドポイント名を設定する必要があります。static_url_path -> 静的 URL パス。指定した場合、すべてのビューの静的 URL ディレクトリへのデフォルトのパスを指定します。ビュー構成でオーバーライドできます。base_template -> すべての静的ビューの基本 HTML テンプレートをオーバーライドします。デフォルトはadmin/base.htmlです。 column_editable_list = [ 'from_user' , 'to_user' , 'subject' , 'content' , 'created_at' ] column_searchable_list = [ 'from_user.first_name' , 'from_user.last_name' , 'from_user.email' , 'to_user.first_name' ,
'to_user.last_name' , 'to_user.email' , 'subject' , 'content' , 'created_at' ] column_exclude_list = [ 'created_at' ] column_details_exclude_list = [ 'created_at' ] column_filters = [ 'subject' , 'content' , 'created_at' ] can_export = True
can_view_details = True
can_create = True
can_edit = True
can_delete = True edit_modal = True
create_modal = True
details_modal = True SECURITY_REGISTERABLE = True SECURITY_RECOVERABLE = True SECURITY_CHANGEABLE = True