-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't use multiple Admin
instances with different Bootstrap themes (FLASK_ADMIN_SWATCH
)
#2423
Comments
If I solve, will PRs be viewed/merged soon? |
The repo is inactive for almost over six months, so O don't think it'll be merged quickly. |
This feels like a useful feature. I'm not sure yet how easy or hard it would be to support this, but if you've got ideas I'd be happy to hear them and would be willing to help review any PR you do put up. Would be good to understand your proposed approach first. |
I've got the idea and the way to implement it in a safe way, I am just looking for time to work on it. But I am sure I will contribute and create my PR soon) |
This problem may also occur when setting up I believe the best fix for this problem could be like this: admin1 = Admin(
app,
endpoint='admin1',
swatch='cerulean', # Instead of `FLASK_ADMIN_SWATCH`
fluid=True, # Instead of `FLASK_ADMIN_FLUID_LAYOUT`
)
admin2 = Admin(
app,
endpoint='admin2',
swatch='cosmo', # Instead of `FLASK_ADMIN_SWATCH`
fluid=False, # Instead of `FLASK_ADMIN_FLUID_LAYOUT`
) Pas the settings to the |
I had a look at this and it might be something we could get into the v2 release. Here's a possible approach: #2462 As I've coded it, it's a breaking change. We could make this a bit softer and wrap the breaking change if we really wanted to - although since we're planning a v2.0.0 release, now's a fair time to get it in. I think it's ideal to wrap all of the configuration around what template 'mode' to use, and its configuration (swatch, fluid, etc) in a single config object and pass this in. We then expose it to all of the templates. This should make it easier for people to hook in their own template modes. |
I actually already made the reslover changes for this, just needed to write the end of the example ) [the button that switches even the current theme] |
@samuelhwilliams as I see you created a complete new configuration class for the Bootstrap options, while I used a new param to |
I'd love to see what you've done so far or what you're planning - if you've covered some use cases that I haven't, we can take the best of both :) |
But mine is quite simple one. Your approach gives the project a seperate and full control over the theming. But there is a catch, you added also |
I don't think we need to. We might not even have to. But with my approach it becomes trivial to make it possible - and I think the more interesting idea is where someone has multiple admin instances for different groups of users. These could be user-provided template configs that point at their own private set of templates configured for each user group specifically. It feels fairly flexible without really costing us much. Each admin instance can we styled exactly the way it wants/needs to be. |
I thought about this when I am making changes, but there were going to be more core changed needed to be done. I haven't really structured this feature in my head, but I think it requires the changes through the Boostrap template folders and some alternations when creating and registering the |
My guess is that when the users use multiple |
β How can we use different Bootstrap themes through multiple
Admin
instances?π¨βπ» This is how I tried to do it:
β But this does NOT work, I wrote this to clarify what I want to do with my issue.
Thanks!
The text was updated successfully, but these errors were encountered: