Skip to content
This repository has been archived by the owner on Jul 29, 2021. It is now read-only.

agdsn/bootstrap-table-py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bootstrap-table-py

Python wrapper for bootstrap-table.

Usage

Declaring the table

class TestTable(BootstrapTable):
    name = Column('Name', width=2)
    profile = LinkColumn('profile', width=5)
    registered = DateColumn('Registered')
    delete_link = BtnColumn('Delete', hide_if=no_del_perm)

    @property
    def toolbar(self):
        if no_create_perm():
            return
        href = url_for(".user_create")
        return button_toolbar("User", href)

Instantiating:

return render_template('user.html',
           table=TestTable(data_url=url_for("users_json")),
       )

Rendering:

{{ table.render("test_table_id") }}

Data endpoint:

return jsonify(items=[{
    'name': user.name,
    'registered': datetime_format(user.registered, formatter=datetime_filter),
    'profile': {
        'href': url_for('user_show', user_id=user.id),
        'title': user.name
    },
    'delete_link': {
        'href': url_for('user_delete', user_id=user.id),
        'title': "Delete",
        'icon': 'fa-trash',
        'btn-class': 'btn-danger'
    }} for user in get_users()])

About

Python wrapper for bootstrap-table

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published