def get_context_data(self, **kwargs): context = super(HomeView, self).get_context_data(**kwargs) hostname_without_port = remove_www(self.request.get_host().split(':')[0]) try: Client.objects.get(schema_name='public') except utils.DatabaseError: context['need_sync'] = True context['shared_apps'] = settings.SHARED_APPS context['tenants_list'] = [] return context except Client.DoesNotExist: context['no_public_tenant'] = True context['hostname'] = hostname_without_port if Client.objects.count() == 1: context['only_public_tenant'] = True context['tenants_list'] = Client.objects.all() return context
def hostname_from_request(self, request): """ Extracts hostname from request. Used for custom requests filtering. By default removes the request's port and common prefixes. """ return remove_www(request.get_host().split(':')[0])
def hostname_from_request(self, request): """ Extracts hostname from request. Used for custom requests filtering. By default removes the request's port and common prefixes. """ return remove_www(request.get_host().split(':')[0]).lower()