Projet

Général

Profil

0001-context-processor-for-appending-tenant-name-in-stati.patch

Serghei Mihai, 24 juin 2014 14:21

Télécharger (1,14 ko)

Voir les différences:

Subject: [PATCH 1/2] context processor for appending tenant name in static url

 entrouvert/djommon/multitenant/context_processors.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 entrouvert/djommon/multitenant/context_processors.py
entrouvert/djommon/multitenant/context_processors.py
1
from django.conf import settings
2
from tenant_schemas.utils import remove_www_and_dev
3

  
4
def static(request):
5
    """
6
    Add tenant dependend static context variable to the context
7
    """
8
    try:
9
        static_url = settings.STATIC_URL
10
    except AttributeError:
11
        raise ImproperlyConfigured('STATIC_URL must be defined')
12

  
13
    return {'STATIC_URL': '%s/%s' % (static_url,
14
                                     remove_www_and_dev(request.get_host().split(':')[0]))}
0
-