Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def django_invalidate_region_map(region_id):
region = Region.objects.get(id=region_id)
def _do_invalidate():
key = MapFullRegionView.get_cache_key(region=region.slug)
cache.delete(key)
from maps.views import MapFullRegionView
current_urlconf = get_urlconf() or settings.ROOT_URLCONF
if region.regionsettings.domain:
# Has a domain, ugh. Need to clear two URLs on two hosts, in this case
set_urlconf('main.urls_no_region')
_do_invalidate()
# Now invalidate main path on LocalWiki hub
def setup_region(self, region):
from regions.models import Region
self.region = Region.objects.get(slug=region)
def get_context_data(self, *args, **kwargs):
context = super(TemplateView, self).get_context_data(*args, **kwargs)
if self.kwargs.get('region'):
context['region'] = Region.objects.get(slug=self.kwargs.get('region'))
context['is_global_dashboard'] = False
else:
context['is_global_dashboard'] = True
return context