Ticket #13814: 13814.diff

File 13814.diff, 676 bytes (added by yuval_a, 5 years ago)

Proposed utility method

  • django/contrib/sites/models.py

    ### Eclipse Workspace Patch 1.0
    #P django-trunk
     
    2323            SITE_CACHE[sid] = current_site
    2424        return current_site
    2525
     26    def get_current_or_request(self, request):
     27        if Site._meta.installed:
     28            site = Site.objects.get_current()
     29        else:
     30            site = RequestSite(request)
     31        return site
     32
    2633    def clear_cache(self):
    2734        """Clears the ``Site`` object cache."""
    2835        global SITE_CACHE
Back to Top