İ ned to write a code sniplet that enables to disable connection to some parts of a site. Admin and the mainpage will be displayable, but user section (which uses ajax) will be displayed, but can not be used (vith a transparent div set over the page). Also there is a few pages which will be disabled.
my logic is that, i write a middleware,
def process_request(self, request):
if ayar.tonline_kapali:
url_parcalari = request.path.split('/')
if url_parcalari[0] not in settings.BAGIMSIZ_URLLER:
if not request.is_ajax():
return render_to_response('bakim_modu.html')
else:
return None
that code let me to display a "site closed" message for the urls not in BAGIMSIZ_URLLER (which contains urls that will be accessible)
But i do not figure out how can i solve the problem about ajax pages... i need to set a header or something to the response and need to check it in the template.