How to use the regions.models.Region.objects.get function in regions

To help you get started, we’ve selected a few regions examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github localwiki / localwiki-backend-server / localwiki / maps / cache.py View on Github external
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
github localwiki / localwiki-backend-server / localwiki / activity / feeds.py View on Github external
def setup_region(self, region):
        from regions.models import Region
        self.region = Region.objects.get(slug=region)
github localwiki / localwiki-backend-server / localwiki / dashboard / views.py View on Github external
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