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
The app is great! 😀 You do a great job for Django users!
However, a nice feature would to have admin toggler turning the 503 mode on and off. Something like this.
I know it's quite simple to implement, for instance by adding a view as follows:
from django.core.exceptions import PermissionDenied
from django.shortcuts import redirect
from maintenance_mode.core import get_maintenance_mode, set_maintenance_mode
def toggle_maintenance_mode(request):
"""
Toggle between 'on' and 'off' mode of the maintenance mode.
"""
if request.user.is_superuser:
set_maintenance_mode(not get_maintenance_mode())
return redirect(request.GET.get("next")) or "/"
raise PermissionDenied
the corresponding URL path, a overriden admin/base.html template:
I did this in my project and had to additionally add /maintenance-mode/ to the MAINTENANCE_MODE_IGNORE_URLS settings, because redirects were blocked by the app.
Feel free to use this idea. I have no abilities to write tests.
The text was updated successfully, but these errors were encountered:
It's possible to write a custom backend that uses a django model for reading/writing the state to the database and then having the relative model-admin for allow admins changing the state from the backend.
Anyway, your solution is independent by the backend used(cool) and the UI is very intuitive!
The app is great! 😀 You do a great job for Django users!
However, a nice feature would to have admin toggler turning the 503 mode on and off. Something like this.
I know it's quite simple to implement, for instance by adding a view as follows:
the corresponding URL path, a overriden
admin/base.html
template:I did this in my project and had to additionally add
/maintenance-mode/
to theMAINTENANCE_MODE_IGNORE_URLS
settings, because redirects were blocked by the app.Feel free to use this idea. I have no abilities to write tests.
The text was updated successfully, but these errors were encountered: