当前位置: 首页>>代码示例>>Python>>正文


Python Admin.register_panel方法代码示例

本文整理汇总了Python中flask_peewee.admin.Admin.register_panel方法的典型用法代码示例。如果您正苦于以下问题:Python Admin.register_panel方法的具体用法?Python Admin.register_panel怎么用?Python Admin.register_panel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在flask_peewee.admin.Admin的用法示例。


在下文中一共展示了Admin.register_panel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: MessageAdmin

# 需要导入模块: from flask_peewee.admin import Admin [as 别名]
# 或者: from flask_peewee.admin.Admin import register_panel [as 别名]
class MessageAdmin(ModelAdmin):
    columns = ('user', 'content', 'pub_date',)

class NoteAdmin(ModelAdmin):
    columns = ('user', 'message', 'created_date',)


auth.register_admin(admin)
admin.register(AModel, AAdmin)
admin.register(BModel, BAdmin)
admin.register(CModel, CAdmin)
admin.register(DModel, DAdmin)
admin.register(BDetails)
admin.register(Message, MessageAdmin)
admin.register(Note, NoteAdmin)
admin.register_panel('Notes', NotePanel)


class UserResource(RestResource):
    exclude = ('password', 'email',)
    
    def get_query(self):
        return User.filter(active=True)

class AResource(RestResource):
    pass

class BResource(RestResource):
    include_resources = {'a': AResource}

class CResource(RestResource):
开发者ID:dahool,项目名称:flask-peewee,代码行数:33,代码来源:test_app.py

示例2: get_context

# 需要导入模块: from flask_peewee.admin import Admin [as 别名]
# 或者: from flask_peewee.admin.Admin import register_panel [as 别名]
    def get_context(self):
        ins = celery.control.inspect()
        return {
            "scheduled_tasks": ins.scheduled(),
            "active_tasks": ins.active()
        }


class ConfigAdmin(ModelAdmin):

    columns = ("name", "value")


class TweetAdmin(ModelAdmin):

    columns = ("id", "created_at", "tweeted_by", "text", "score")


class UserAdmin(ModelAdmin):

    columns = ("username", "email", "admin")


admin = Admin(app, auth, branding="Power Poetry Twitter Demo")
admin.register(Config, ConfigAdmin)
admin.register(Tweet, TweetAdmin)
admin.register(User, UserAdmin)
admin.register_panel("Celery Tasks", TasksPanel)

admin.setup()
开发者ID:SumAllFoundation,项目名称:powerpoetry-twitter-demo,代码行数:32,代码来源:admin.py

示例3: get_context

# 需要导入模块: from flask_peewee.admin import Admin [as 别名]
# 或者: from flask_peewee.admin.Admin import register_panel [as 别名]
    def get_context(self):
        last_week = datetime.datetime.now() - datetime.timedelta(days=7)
        signups_this_week = User.select().where(User.join_date > last_week).count()
        messages_this_week = Message.select().where(Message.pub_date > last_week).count()
        return {
            'signups': signups_this_week,
            'messages': messages_this_week,
        }


admin = Admin(app, auth, branding='Admin the boat')


class MessageAdmin(ModelAdmin):
    columns = ('user', 'content', 'pub_date',)
    foreign_key_lookups = {'user': 'username'}
    filter_fields = ('user', 'content', 'pub_date', 'user__username')

class NoteAdmin(ModelAdmin):
    columns = ('user', 'message', 'created_date',)
    exclude = ('created_date',)


auth.register_admin(admin)
#admin.register(Relationship)
admin.register(Message, MessageAdmin)
admin.register(Note, NoteAdmin)
admin.register_panel('Notes', NotePanel)
admin.register_panel('User stats', UserStatsPanel)
开发者ID:sekenned,项目名称:totb,代码行数:31,代码来源:admin.py

示例4: NoteAdmin

# 需要导入模块: from flask_peewee.admin import Admin [as 别名]
# 或者: from flask_peewee.admin.Admin import register_panel [as 别名]
    columns = ("user", "content", "pub_date")


class NoteAdmin(ModelAdmin):
    columns = ("user", "message", "created_date")


auth.register_admin(admin)
admin.register(AModel, AAdmin)
admin.register(BModel, BAdmin)
admin.register(CModel, CAdmin)
admin.register(DModel, DAdmin)
admin.register(BDetails)
admin.register(Message, MessageAdmin)
admin.register(Note, NoteAdmin)
admin.register_panel("Notes", NotePanel)


class UserResource(RestResource):
    exclude = ("password", "email")

    def get_query(self):
        return User.select().where(User.active == True)


class AResource(RestResource):
    pass


class BResource(RestResource):
    include_resources = {"a": AResource}
开发者ID:nekybrate,项目名称:flask-peewee,代码行数:33,代码来源:test_app.py


注:本文中的flask_peewee.admin.Admin.register_panel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。