Comments (2)
I'm not entirely sure and I didn't think thoroughly but this approach might solve #681.
from sqladmin.
What I learned so far
Flask Admin Routing
As I said, Flask Admin creates a dedicated blueprint for each view and they are all registered directly to the application.
Consider two views: UserView
and PostView
. UserView
has a blueprint named user_view
and PostView
has a blueprint named post_view
.
Flask Admin also registers an AdminIndexView
by default and its blueprint is named admin
.
In Flask Admin, every view has an exposed method named index_view
.
So the URL-building process is like this:
/admin/
:url_for("admin.index_view")
/admin/user
:url_for("user_view.index_view")
/admin/user/new
:url_for("user_view.create_view")
Flask Admin registers AdminIndexView
before all other views. That's why I failed when I tried to adopt its core to use Starlette. AdminIndexView
occupies all URLs starting with /admin/*
when I use Mount
.
Starlette Routing
Mount
builds an application (if not provided), and the URL that is used while mounting an application, router, or group of routes is occupied by this application.
Route naming: we can name our routes with a colon separator.
admin_routes = [
Route(..., name="admin:index_view"),
Route(..., name="admin:user_view:index_view"),
Route(..., name="admin:rediscli1:index_view"),
Route(..., name="admin:rediscli2:index_view"),
]
Conclusion
Each view gets registered (mounted) to the main application. Not to an application to be mounted to the main application.
Each view has a dedicated blueprint (Router or Mount instance) and each exposed function gets registered to this blueprint.
Questions
- Do we need something like
AdminIndexView
? - Do we need a separate application instance to mount admin to the main application?
- We can name expose functions like
rediscli:index_view
and they'll be directly registered to theSQLAdmin
application and will be accessible by doingurl_for("admin:rediscli:index_view")
but what about the URLs? - How does moving
list
,details
,delete
,create
,edit
,export
, andajax_lookup
methods to the views as exposed methods sound like? This is the Flask Admin approach to the problem.
In the end problem remains: View can not have a name prefix... So if the user has two custom views with the same exposed URLs, there will be conflicts...
from sqladmin.
Related Issues (20)
- TypeError: UUID objects are immutable (fastapi_users) HOT 4
- ValueError on passing unexcepted parameter
- Use HTMX HOT 3
- jinja2.exceptions.TemplateNotFound: list.html HOT 3
- with ... as ... statement can make sesssion close,which will lead to DetachedInstanceError HOT 8
- [feature request] Custom login page HOT 1
- Page size selection at bottom sometimes takes the user to non existing page
- Ckeditor <TypeError: Cannot convert undefined or null to object> HOT 1
- Specify particular column to be searched. HOT 1
- sqlalchemy column_property should be ignore when create/update HOT 10
- Internationalization and Localization support HOT 1
- Datetime with timezone edited incorrectly HOT 1
- Image corruption when editing other fields HOT 2
- Adding custom filtering for relationships ModelConverterBase._prepare_select_options
- Redirect to custom url after creation HOT 1
- Support for pgvector.sqlalchemy.vector.VECTOR field support HOT 1
- Document update may be required to resolve DeprecationWarning from Starlette HOT 1
- deferred=True which will lead to DetachedInstanceError HOT 3
- Mark the field as non-linked
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqladmin.