Example #1
0
def setup_admin():
    auth = Auth(app, db, user_model=User)
    admin = Admin(app, auth)
    admin.register(User, UserAdmin)
    admin.register(Photo, PhotoAdmin)
    auth.register_admin(admin)
    admin.setup()
    return auth, admin
Example #2
0
def setup_admin():
    auth = Auth(app, db)
    admin = Admin(app, auth)
    admin.register(Note, NoteAdmin)
    admin.register(Author, AuthorAdmin)
    auth.register_admin(admin)
    admin.setup()
    return auth, admin
Example #3
0
class CAdmin(ModelAdmin):
    columns = ('b', 'c_field',)
    include_foreign_keys = {'b': 'b_field'}

class DAdmin(ModelAdmin):
    columns = ('c', 'd_field',)
    include_foreign_keys = {'c': 'c_field'}

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)