You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello again! I've got the dashboard up and running on my site and it's working great.
One thing I'd like to do, if possible, is style the dashboard views so that they look like they're part of the admin site (since on my site, they are accessible only to staff, from the Django admin). On a lark, I tried setting my django_sql_dashboard/base.html to the following:
{%extends"admin/base_site.html"%}{%loadstatic%}{%blockextrahead%}
<style>{% include "django_sql_dashboard/_css.html" %}</style>
{%endblock%}
This actually came really close to working! I'm not sure if it was intentional on your part, but django-sql-dashboard's custom CSS melds with the admin site's CSS quite nicely:
There are two problems, though:
The template isn't being passed the context of AdminSite.each_context(), so a bunch of stuff that's usually shown in the header isn't being shown. If there were a way to pass custom context to the dashboard views, it would be awesome.
The title displays twice, I feel like there should be an easy way around this, but the only thing I can think of right now is a horrible CSS hack:
h1~h1 {
display: none;
}
Anyways, I guess that means (1) is the only real blocker for me. Looking at django-sql-dashboard's code, I can't see any easy way of injecting extra context into the dashboard views. One possibility I can think of might be to add optional extra_context arguments to the views, which I'd be happy to submit a PR for. Anyways, let me know if you have any thoughts!
The text was updated successfully, but these errors were encountered:
Having this as a documented, supported way of using the tool makes a ton of sense to me. I like the pattern of wrapping the Django SQL Dashboard view with a custom view to add extra context - an extra_context= argument sounds like it could help there.
I don't understand why the title shows twice, but we should definitely find a fix for that!
Hey, I just noticed that you mentioned this over in #127 (comment):
I think the way to address this would be to switch over to more of a class-based-view approach to allow people to subclass the dashboard views and implement things like their own custom permissions.
While this issue isn't directly related to that one, I think that a good solution to this one might be the same kind of thing--moving the views over to more of a class-based-view approach that would allow these sorts of things to be easily customized. Anyways, just a random thought I figured I'd log here.
Hello again! I've got the dashboard up and running on my site and it's working great.
One thing I'd like to do, if possible, is style the dashboard views so that they look like they're part of the admin site (since on my site, they are accessible only to staff, from the Django admin). On a lark, I tried setting my
django_sql_dashboard/base.html
to the following:This actually came really close to working! I'm not sure if it was intentional on your part, but django-sql-dashboard's custom CSS melds with the admin site's CSS quite nicely:
There are two problems, though:
The template isn't being passed the context of
AdminSite.each_context()
, so a bunch of stuff that's usually shown in the header isn't being shown. If there were a way to pass custom context to the dashboard views, it would be awesome.The title displays twice, I feel like there should be an easy way around this, but the only thing I can think of right now is a horrible CSS hack:
Anyways, I guess that means (1) is the only real blocker for me. Looking at django-sql-dashboard's code, I can't see any easy way of injecting extra context into the dashboard views. One possibility I can think of might be to add optional
extra_context
arguments to the views, which I'd be happy to submit a PR for. Anyways, let me know if you have any thoughts!The text was updated successfully, but these errors were encountered: