fabiocaccamo/django-maintenance-mode

Is it possible to have this not redirect?

sillyfatcat opened this issue · 1 comments

Effectively I just need something that would let me know whether the site's under maintenance or not and allow my base.html to display a toast message. So I really only want to use {% if maintenance_mode %}. Is it currently possible to change its behavior to not redirect to a maintenance page?

@sshum00 to do this you need to remove maintenance_mode.middleware.MaintenanceModeMiddleware from settings.MIDDLEWARE_CLASSES, then in your view retrieve the maintenance_mode state:

from maintenance_mode.core import get_maintenance_mode

maintenance_mode_state = get_maintenance_mode()

and pass the maintenance_mode_state variable to your template.