dizballanze / django-admin-env-notice Goto Github PK
View Code? Open in Web Editor NEWVisually distinguish environments in Django Admin
License: MIT License
Visually distinguish environments in Django Admin
License: MIT License
Say Thanks link in the README.md
is broken.
Float mode works great except if you have longer pages...then it eventually scrolls off-screen as you scroll down the page.
I am trying to setup django admin env notice using django grappelli
I installed the package and I got the following:
But when I scroll down I see a space in the top because the position of the header in grappelli is fixed
Would be great to have compatibility with grappelli.
Regards.
Incorrect wrapping/closing. Lines 16 and 17 should be switched.
Dont work, I follow all the settings and do not modify the admin template.
Body:before is not work
Installed per instructions, set ENVIRONMENT_NAME, ENVIRONMENT_COLOR.
Expected to see a RED banner with Production on the /admin after login.
Got nothing.
Paste the command(s) you ran and the output.
If there was a crash, please include the traceback here.
Putting unsafe-inline
scripts is restricted via django-csp
.
You can try to reproduce this issue in this template: https://github.com/wemake-services/wemake-django-template
127.0.0.1/:10 Refused to apply inline style because it violates the following Content Security Policy directive: "style-src 'self' cdn.rawgit.com". Either the 'unsafe-inline' keyword, a hash ('sha256-QaA+rno7IxCZrUdNWEHh6+Xx4plAX/G3Py8TzgPyLJ0='), or a nonce ('nonce-...') is required to enable inline execution.
What do I suggest? I suggest using nonce
to fix it: https://django-csp.readthedocs.io/en/latest/nonce.html#context-processor
So, this will only require that CSP
context processors should come before yours.
I need for some parts of my application a custom management interface that cannot be done with the Django admin interface. Is there a way how I can show this notice in a "normal" template?
I'm wondering if you would be open to adding a new feature or accepting a PR along the following lines:
On my sites, I like to put additional information in the env bar, such as the name of the git branch the site is on, the sha, and other information that ideally, I'd want to keep out of the public eye. It would be possible to modify the template to only show the bar if the user is_authorized
, effectively limiting the data in the header to logged-in users. This feature would default to showing the bar, but could be enabled via an environment variable.
What do you think?
It would be cool to have a third variable for text color, so that using bright banners doesn't result in unreadable white-on-white.
It would be nice to have a separate header identical to the environment notice header, but above it, to let a user know when JavaScript is disabled (as some admin features seem to depend on JS).
So if JavaScript is disabled, the new noscript header would just push the environment header down, and both would be sticky, if this is selected in settings.
Disclosure: I have never tried this package with anything like Grappelli, but hopefully the additional header would not interfere with other packages such as that.
Trying to get django-admin-env-notice to work with grappelli
The bar is not showing on the admin site
ENVIRONMENT_NAME = 'Local'
ENVIRONMENT_COLOR = 'GREY'
Tried the following selectors and also without any selectors:
ENVIRONMENT_ADMIN_SELECTOR = "grp-header"
ENVIRONMENT_ADMIN_SELECTOR = ".grp-module-login:before, #grp-header"
ENVIRONMENT_FLOAT = True
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates/')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django_admin_env_notice.context_processors.from_settings',
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.template.context_processors.request',
],
},
},
]
django_admin_env_notice in INSTALLED_APPS above django.contrib.admin
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.