flask-admin-tabler 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. flask_admin_tabler-0.1.1/.editorconfig +13 -0
  2. flask_admin_tabler-0.1.1/.github/FUNDING.yml +1 -0
  3. flask_admin_tabler-0.1.1/.github/dependabot.yml +24 -0
  4. flask_admin_tabler-0.1.1/.github/workflows/new_release.yml +35 -0
  5. flask_admin_tabler-0.1.1/.github/workflows/tests.yml +41 -0
  6. flask_admin_tabler-0.1.1/.gitignore +208 -0
  7. flask_admin_tabler-0.1.1/.pre-commit-config.yaml +36 -0
  8. flask_admin_tabler-0.1.1/LICENSE +21 -0
  9. flask_admin_tabler-0.1.1/PKG-INFO +86 -0
  10. flask_admin_tabler-0.1.1/README.md +57 -0
  11. flask_admin_tabler-0.1.1/examples/quickstart.py +59 -0
  12. flask_admin_tabler-0.1.1/flask_admin_tabler/__init__.py +18 -0
  13. flask_admin_tabler-0.1.1/flask_admin_tabler/json_widget.py +363 -0
  14. flask_admin_tabler-0.1.1/flask_admin_tabler/static/admin/css/tabler/admin.css +90 -0
  15. flask_admin_tabler-0.1.1/flask_admin_tabler/static/admin/css/tabler/rediscli.css +48 -0
  16. flask_admin_tabler-0.1.1/flask_admin_tabler/static/tabler/css/tabler-themes.min.css +8 -0
  17. flask_admin_tabler-0.1.1/flask_admin_tabler/static/tabler/css/tabler.min.css +9 -0
  18. flask_admin_tabler-0.1.1/flask_admin_tabler/static/tabler/icons/fonts/tabler-icons.ttf +0 -0
  19. flask_admin_tabler-0.1.1/flask_admin_tabler/static/tabler/icons/fonts/tabler-icons.woff +0 -0
  20. flask_admin_tabler-0.1.1/flask_admin_tabler/static/tabler/icons/fonts/tabler-icons.woff2 +0 -0
  21. flask_admin_tabler-0.1.1/flask_admin_tabler/static/tabler/icons/tabler-icons.min.css +4 -0
  22. flask_admin_tabler-0.1.1/flask_admin_tabler/static/tabler/js/tabler.min.js +13 -0
  23. flask_admin_tabler-0.1.1/flask_admin_tabler/static/vendor/highlightjs/highlight.min.js +1244 -0
  24. flask_admin_tabler-0.1.1/flask_admin_tabler/static/vendor/highlightjs/styles/googlecode.min.css +1 -0
  25. flask_admin_tabler-0.1.1/flask_admin_tabler/static/vendor/highlightjs/styles/monokai.min.css +1 -0
  26. flask_admin_tabler-0.1.1/flask_admin_tabler/templates/tabler/admin/actions.html +38 -0
  27. flask_admin_tabler-0.1.1/flask_admin_tabler/templates/tabler/admin/base.html +219 -0
  28. flask_admin_tabler-0.1.1/flask_admin_tabler/templates/tabler/admin/file/form.html +29 -0
  29. flask_admin_tabler-0.1.1/flask_admin_tabler/templates/tabler/admin/file/list.html +210 -0
  30. flask_admin_tabler-0.1.1/flask_admin_tabler/templates/tabler/admin/file/modals/form.html +19 -0
  31. flask_admin_tabler-0.1.1/flask_admin_tabler/templates/tabler/admin/index.html +4 -0
  32. flask_admin_tabler-0.1.1/flask_admin_tabler/templates/tabler/admin/layout.html +109 -0
  33. flask_admin_tabler-0.1.1/flask_admin_tabler/templates/tabler/admin/lib.html +290 -0
  34. flask_admin_tabler-0.1.1/flask_admin_tabler/templates/tabler/admin/master.html +1 -0
  35. flask_admin_tabler-0.1.1/flask_admin_tabler/templates/tabler/admin/model/create.html +30 -0
  36. flask_admin_tabler-0.1.1/flask_admin_tabler/templates/tabler/admin/model/details.html +52 -0
  37. flask_admin_tabler-0.1.1/flask_admin_tabler/templates/tabler/admin/model/edit.html +40 -0
  38. flask_admin_tabler-0.1.1/flask_admin_tabler/templates/tabler/admin/model/inline_field_list.html +15 -0
  39. flask_admin_tabler-0.1.1/flask_admin_tabler/templates/tabler/admin/model/inline_form.html +4 -0
  40. flask_admin_tabler-0.1.1/flask_admin_tabler/templates/tabler/admin/model/inline_list_base.html +45 -0
  41. flask_admin_tabler-0.1.1/flask_admin_tabler/templates/tabler/admin/model/layout.html +107 -0
  42. flask_admin_tabler-0.1.1/flask_admin_tabler/templates/tabler/admin/model/list.html +198 -0
  43. flask_admin_tabler-0.1.1/flask_admin_tabler/templates/tabler/admin/model/modals/create.html +26 -0
  44. flask_admin_tabler-0.1.1/flask_admin_tabler/templates/tabler/admin/model/modals/details.html +40 -0
  45. flask_admin_tabler-0.1.1/flask_admin_tabler/templates/tabler/admin/model/modals/edit.html +27 -0
  46. flask_admin_tabler-0.1.1/flask_admin_tabler/templates/tabler/admin/model/row_actions.html +38 -0
  47. flask_admin_tabler-0.1.1/flask_admin_tabler/templates/tabler/admin/rediscli/console.html +27 -0
  48. flask_admin_tabler-0.1.1/flask_admin_tabler/templates/tabler/admin/rediscli/response.html +32 -0
  49. flask_admin_tabler-0.1.1/flask_admin_tabler/templates/tabler/admin/static.html +3 -0
  50. flask_admin_tabler-0.1.1/flask_admin_tabler/theme.py +78 -0
  51. flask_admin_tabler-0.1.1/pyproject.toml +86 -0
  52. flask_admin_tabler-0.1.1/tests/__init__.py +0 -0
  53. flask_admin_tabler-0.1.1/tests/test_theme.py +95 -0
@@ -0,0 +1,13 @@
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = space
5
+ indent_size = 4
6
+ insert_final_newline = true
7
+ trim_trailing_whitespace = true
8
+ end_of_line = lf
9
+ charset = utf-8
10
+ max_line_length = 119
11
+
12
+ [*.{css,html,js,json,jsx,scss,ts,tsx,yaml,yml}]
13
+ indent_size = 2
@@ -0,0 +1 @@
1
+ github: mariofix
@@ -0,0 +1,24 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "pip"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
7
+ allow:
8
+ - dependency-type: "all"
9
+ assignees:
10
+ - "mariofix"
11
+ commit-message:
12
+ prefix: "poetry prod"
13
+ prefix-development: "poetry dev"
14
+ include: "scope"
15
+ - package-ecosystem: "github-actions"
16
+ directory: "/"
17
+ schedule:
18
+ interval: "weekly"
19
+ allow:
20
+ - dependency-type: "all"
21
+ commit-message:
22
+ prefix: "actions prod"
23
+ prefix-development: "actions dev"
24
+ include: "scope"
@@ -0,0 +1,35 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+
11
+ environment:
12
+ name: pypi
13
+ url: https://pypi.org/p/flask-admin-tabler
14
+
15
+ permissions:
16
+ id-token: write
17
+
18
+ steps:
19
+ - uses: actions/checkout@v3
20
+
21
+ - name: Set up Python
22
+ uses: actions/setup-python@v6
23
+ with:
24
+ python-version: "3.13"
25
+
26
+ - name: Install flit
27
+ run: |
28
+ python -m pip install --upgrade pip
29
+ pip install flit
30
+
31
+ - name: Build package
32
+ run: flit build
33
+
34
+ - name: Publish to PyPI
35
+ uses: pypa/gh-action-pypi-publish@v1.13.0
@@ -0,0 +1,41 @@
1
+ name: Tests & Coverage
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - sandbox
7
+ pull_request:
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ permissions:
13
+ contents: read
14
+ strategy:
15
+ matrix:
16
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
17
+
18
+ steps:
19
+ - uses: actions/checkout@v6
20
+
21
+ - name: Set up Python ${{ matrix.python-version }}
22
+ uses: actions/setup-python@v6
23
+ with:
24
+ python-version: ${{ matrix.python-version }}
25
+
26
+ - name: Install dependencies
27
+ run: |
28
+ python -m pip install --upgrade pip
29
+ pip install .[dev]
30
+
31
+ - name: Run tests with coverage
32
+ run: |
33
+ pip install pytest-cov coverage
34
+ pytest --cov=flask_admin_tabler --cov-report=term-missing
35
+
36
+
37
+ # - name: Upload coverage to Coveralls
38
+ # if: matrix.python-version == '3.13'
39
+ # env:
40
+ # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41
+ # run: coveralls
@@ -0,0 +1,208 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+ *.code-workspace
6
+
7
+ # C extensions
8
+ *.so
9
+
10
+ # Distribution / packaging
11
+ .Python
12
+ build/
13
+ develop-eggs/
14
+ dist/
15
+ downloads/
16
+ eggs/
17
+ .eggs/
18
+ lib/
19
+ lib64/
20
+ parts/
21
+ sdist/
22
+ var/
23
+ wheels/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py.cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+ cover/
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+ db.sqlite3-journal
64
+
65
+ # Flask stuff:
66
+ instance/
67
+ .webassets-cache
68
+
69
+ # Scrapy stuff:
70
+ .scrapy
71
+
72
+ # Sphinx documentation
73
+ docs/_build/
74
+
75
+ # PyBuilder
76
+ .pybuilder/
77
+ target/
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # IPython
83
+ profile_default/
84
+ ipython_config.py
85
+
86
+ # pyenv
87
+ # For a library or package, you might want to ignore these files since the code is
88
+ # intended to run in multiple environments; otherwise, check them in:
89
+ .python-version
90
+
91
+ # pipenv
92
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
94
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
95
+ # install all needed dependencies.
96
+ #Pipfile.lock
97
+
98
+ # UV
99
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
100
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
101
+ # commonly ignored for libraries.
102
+ uv.lock
103
+
104
+ # poetry
105
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
106
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
107
+ # commonly ignored for libraries.
108
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
109
+ poetry.lock
110
+ #poetry.toml
111
+
112
+ # pdm
113
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
114
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
115
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
116
+ #pdm.lock
117
+ #pdm.toml
118
+ .pdm-python
119
+ .pdm-build/
120
+
121
+ # pixi
122
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
123
+ #pixi.lock
124
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
125
+ # in the .venv directory. It is recommended not to include this directory in version control.
126
+ .pixi
127
+
128
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
129
+ __pypackages__/
130
+
131
+ # Celery stuff
132
+ celerybeat-schedule
133
+ celerybeat.pid
134
+
135
+ # SageMath parsed files
136
+ *.sage.py
137
+
138
+ # Environments
139
+ .env
140
+ .envrc
141
+ .venv
142
+ env/
143
+ venv/
144
+ ENV/
145
+ env.bak/
146
+ venv.bak/
147
+
148
+ # Spyder project settings
149
+ .spyderproject
150
+ .spyproject
151
+
152
+ # Rope project settings
153
+ .ropeproject
154
+
155
+ # mkdocs documentation
156
+ /site
157
+
158
+ # mypy
159
+ .mypy_cache/
160
+ .dmypy.json
161
+ dmypy.json
162
+
163
+ # Pyre type checker
164
+ .pyre/
165
+
166
+ # pytype static type analyzer
167
+ .pytype/
168
+
169
+ # Cython debug symbols
170
+ cython_debug/
171
+
172
+ # PyCharm
173
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
174
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
175
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
176
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
177
+ #.idea/
178
+
179
+ # Abstra
180
+ # Abstra is an AI-powered process automation framework.
181
+ # Ignore directories containing user credentials, local state, and settings.
182
+ # Learn more at https://abstra.io/docs
183
+ .abstra/
184
+
185
+ # Visual Studio Code
186
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
187
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
188
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
189
+ # you could uncomment the following to ignore the entire vscode folder
190
+ # .vscode/
191
+
192
+ # Ruff stuff:
193
+ .ruff_cache/
194
+
195
+ # PyPI configuration file
196
+ .pypirc
197
+
198
+ # Cursor
199
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
200
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
201
+ # refer to https://docs.cursor.com/context/ignore-files
202
+ .cursorignore
203
+ .cursorindexingignore
204
+
205
+ # Marimo
206
+ marimo/_static/
207
+ marimo/_lsp/
208
+ __marimo__/
@@ -0,0 +1,36 @@
1
+ ci:
2
+ autoupdate_schedule: monthly
3
+ repos:
4
+ - repo: https://github.com/pre-commit/pre-commit-hooks
5
+ rev: v6.0.0
6
+ hooks:
7
+ - id: trailing-whitespace
8
+ args: [--markdown-linebreak-ext=md]
9
+ - id: end-of-file-fixer
10
+ - id: check-toml
11
+ - id: check-yaml
12
+ args: ["--unsafe"]
13
+ - id: check-added-large-files
14
+ - id: check-case-conflict
15
+ - id: mixed-line-ending
16
+ - id: check-merge-conflict
17
+ - id: debug-statements
18
+ - id: fix-byte-order-marker
19
+ - id: trailing-whitespace
20
+ exclude: ^flask_admin_tabler/static/
21
+ - id: end-of-file-fixer
22
+ exclude: ^flask_admin_tabler/static/
23
+ - repo: https://github.com/pycqa/isort
24
+ rev: 8.0.0
25
+ hooks:
26
+ - id: isort
27
+ args: ["--profile", "black", "--filter-files"]
28
+ - repo: https://github.com/psf/black
29
+ rev: 26.1.0
30
+ hooks:
31
+ - id: black
32
+ - repo: https://github.com/asottile/pyupgrade
33
+ rev: v3.21.2
34
+ hooks:
35
+ - id: pyupgrade
36
+ args: [--py310-plus]
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mario Hernandez
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,86 @@
1
+ Metadata-Version: 2.4
2
+ Name: flask-admin-tabler
3
+ Version: 0.1.1
4
+ Summary: Tabler UI theme for Flask-Admin
5
+ Keywords: flask,flask-admin,tabler,admin-interface,theme,template
6
+ Requires-Python: >=3.10,<4.0
7
+ Description-Content-Type: text/markdown
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Environment :: Web Environment
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: BSD License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
20
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
+ License-File: LICENSE
22
+ Requires-Dist: flask-admin>=2.0.2
23
+ Requires-Dist: pre-commit ; extra == "dev"
24
+ Requires-Dist: black ; extra == "dev"
25
+ Requires-Dist: isort ; extra == "dev"
26
+ Project-URL: Source, https://github.com/mariofix/flask-admin-tablerui
27
+ Provides-Extra: dev
28
+
29
+ # flask-admin-tabler
30
+
31
+ A [Tabler UI](https://tabler.io/) theme for [Flask-Admin](https://github.com/pallets-eco/flask-admin).
32
+
33
+ ## Installation
34
+
35
+ ```shell
36
+ pip install flask-admin-tabler
37
+ ```
38
+
39
+ ## Usage
40
+
41
+ Call `theme.init_app(app)` **before** creating the `Admin` instance so that the
42
+ Tabler templates are registered with higher priority than Flask-Admin's default
43
+ Bootstrap ones.
44
+
45
+ ```python
46
+ from flask import Flask
47
+ from flask_admin import Admin
48
+ from flask_admin_tabler import TablerTheme
49
+
50
+ app = Flask(__name__)
51
+ app.config["SECRET_KEY"] = "change-me"
52
+
53
+ theme = TablerTheme()
54
+ theme.init_app(app) # must come before Admin(app, ...)
55
+
56
+ admin = Admin(app, name="My App", theme=theme)
57
+ ```
58
+
59
+ That's it - navigating to `/admin/` will now render the Tabler UI instead of
60
+ the default Bootswatch theme.
61
+
62
+ A fully runnable example (including a SQLAlchemy model and sample data) is
63
+ available in [`examples/quickstart.py`](examples/quickstart.py):
64
+
65
+ ```shell
66
+ pip install flask-admin-tabler flask-sqlalchemy
67
+ python examples/quickstart.py
68
+ # open http://127.0.0.1:5000/admin/
69
+ ```
70
+
71
+ ## How it works
72
+
73
+ `TablerTheme.init_app(app)` registers a Flask blueprint named
74
+ `flask_admin_tabler` that:
75
+
76
+ 1. **Templates** - exposes `flask_admin_tabler/templates/tabler/` as a template
77
+ folder. Because this blueprint is registered *before* Flask-Admin's admin
78
+ blueprint, Flask resolves `admin/base.html` (and all other admin templates)
79
+ from here first.
80
+ 2. **Static files** - serves the small amount of theme-specific CSS (e.g.
81
+ `admin/css/tabler/admin.css`) at `/static/flask_admin_tabler/`.
82
+
83
+ Tabler's core CSS and JS are loaded from the jsDelivr CDN - no local copies
84
+ needed.
85
+
86
+
@@ -0,0 +1,57 @@
1
+ # flask-admin-tabler
2
+
3
+ A [Tabler UI](https://tabler.io/) theme for [Flask-Admin](https://github.com/pallets-eco/flask-admin).
4
+
5
+ ## Installation
6
+
7
+ ```shell
8
+ pip install flask-admin-tabler
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ Call `theme.init_app(app)` **before** creating the `Admin` instance so that the
14
+ Tabler templates are registered with higher priority than Flask-Admin's default
15
+ Bootstrap ones.
16
+
17
+ ```python
18
+ from flask import Flask
19
+ from flask_admin import Admin
20
+ from flask_admin_tabler import TablerTheme
21
+
22
+ app = Flask(__name__)
23
+ app.config["SECRET_KEY"] = "change-me"
24
+
25
+ theme = TablerTheme()
26
+ theme.init_app(app) # must come before Admin(app, ...)
27
+
28
+ admin = Admin(app, name="My App", theme=theme)
29
+ ```
30
+
31
+ That's it - navigating to `/admin/` will now render the Tabler UI instead of
32
+ the default Bootswatch theme.
33
+
34
+ A fully runnable example (including a SQLAlchemy model and sample data) is
35
+ available in [`examples/quickstart.py`](examples/quickstart.py):
36
+
37
+ ```shell
38
+ pip install flask-admin-tabler flask-sqlalchemy
39
+ python examples/quickstart.py
40
+ # open http://127.0.0.1:5000/admin/
41
+ ```
42
+
43
+ ## How it works
44
+
45
+ `TablerTheme.init_app(app)` registers a Flask blueprint named
46
+ `flask_admin_tabler` that:
47
+
48
+ 1. **Templates** - exposes `flask_admin_tabler/templates/tabler/` as a template
49
+ folder. Because this blueprint is registered *before* Flask-Admin's admin
50
+ blueprint, Flask resolves `admin/base.html` (and all other admin templates)
51
+ from here first.
52
+ 2. **Static files** - serves the small amount of theme-specific CSS (e.g.
53
+ `admin/css/tabler/admin.css`) at `/static/flask_admin_tabler/`.
54
+
55
+ Tabler's core CSS and JS are loaded from the jsDelivr CDN - no local copies
56
+ needed.
57
+
@@ -0,0 +1,59 @@
1
+ """
2
+ Quickstart example – flask-admin-tabler
3
+ =======================================
4
+
5
+ Run this file directly to launch a minimal Flask-Admin application that uses
6
+ the Tabler UI theme::
7
+
8
+ pip install flask-admin-tabler flask-sqlalchemy
9
+ python examples/quickstart.py
10
+
11
+ Then open http://127.0.0.1:5000/admin/ in your browser.
12
+ """
13
+
14
+ from flask import Flask
15
+ from flask_admin import Admin
16
+ from flask_admin.contrib.sqla import ModelView
17
+ from flask_sqlalchemy import SQLAlchemy
18
+
19
+ from flask_admin_tabler import TablerTheme
20
+
21
+ app = Flask(__name__)
22
+ app.config["SECRET_KEY"] = "change-me" # replace with a secure random value in production
23
+ app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite://" # in-memory database
24
+
25
+ db = SQLAlchemy(app)
26
+
27
+
28
+ class User(db.Model):
29
+ id = db.Column(db.Integer, primary_key=True)
30
+ username = db.Column(db.String(80), unique=True, nullable=False)
31
+ email = db.Column(db.String(120), unique=True, nullable=False)
32
+
33
+ def __repr__(self):
34
+ return f"<User {self.username}>"
35
+
36
+
37
+ # 1. Create the theme
38
+ theme = TablerTheme()
39
+
40
+ # 2. Register it with the app BEFORE creating the Admin instance
41
+ theme.init_app(app)
42
+
43
+ # 3. Pass the theme to Admin
44
+ admin = Admin(app, name="Quickstart", theme=theme)
45
+ admin.add_view(ModelView(User, db.session))
46
+
47
+ if __name__ == "__main__":
48
+ with app.app_context():
49
+ db.create_all()
50
+ # Add some sample data if the table is empty
51
+ if not User.query.first():
52
+ db.session.add_all(
53
+ [
54
+ User(username="alice", email="alice@example.com"),
55
+ User(username="bob", email="bob@example.com"),
56
+ ]
57
+ )
58
+ db.session.commit()
59
+ app.run() # add debug=True locally if you want auto-reload
@@ -0,0 +1,18 @@
1
+ from flask_admin_tabler.json_widget import (
2
+ JsonColumnsMixin,
3
+ JsonTextAreaWidget,
4
+ json_detail_formatter,
5
+ json_list_formatter,
6
+ )
7
+ from flask_admin_tabler.theme import TablerTheme
8
+
9
+ tabler_bool_formatter = TablerTheme.bool_formatter
10
+
11
+ __all__ = [
12
+ "TablerTheme",
13
+ "tabler_bool_formatter",
14
+ "JsonColumnsMixin",
15
+ "JsonTextAreaWidget",
16
+ "json_detail_formatter",
17
+ "json_list_formatter",
18
+ ]