Browse Source

Updated settings and context processors to work with basic pods and banners

master
David Winterbottom 15 years ago
parent
commit
e7ccabfbca

+ 9
- 3
examples/defaultshop/settings.py View File

72
 )
72
 )
73
 
73
 
74
 TEMPLATE_CONTEXT_PROCESSORS = (
74
 TEMPLATE_CONTEXT_PROCESSORS = (
75
-    'oscar.marketing.context_processors.banners',
76
-    'django.contrib.auth.context_processors.auth',
77
-)
75
+    "django.contrib.auth.context_processors.auth",
76
+    "django.core.context_processors.debug",
77
+    "django.core.context_processors.i18n",
78
+    "django.core.context_processors.media",
79
+    "django.core.context_processors.static",
80
+    "django.contrib.messages.context_processors.messages",
81
+    # Oscar specific
82
+    'oscar.marketing.context_processors.marketing',
83
+) 
78
 
84
 
79
 MIDDLEWARE_CLASSES = (
85
 MIDDLEWARE_CLASSES = (
80
     'django.middleware.common.CommonMiddleware',
86
     'django.middleware.common.CommonMiddleware',

+ 8
- 3
oscar/marketing/context_processors.py View File

5
 marketing_models = import_module('marketing.models', ['Banner', 'Pod'])
5
 marketing_models = import_module('marketing.models', ['Banner', 'Pod'])
6
 
6
 
7
 
7
 
8
-def banners(request):
9
-    bindings = {}
10
-    
8
+def marketing(request):
9
+    u"""
10
+    For adding bindings for banners and pods to the template
11
+    context.
12
+    """
13
+    bindings = {
14
+        'url_path': request.path
15
+    }
11
     
16
     
12
     # Look for a banner
17
     # Look for a banner
13
     try:
18
     try:

+ 1
- 0
oscar/templates/layout.html View File

34
                     {% endif %}
34
                     {% endif %}
35
                 {% endfor %}
35
                 {% endfor %}
36
             {% endif %}
36
             {% endif %}
37
+            <a href="/admin/marketing/pod/add/?page_url={{ url_path }}" >Add a pod to this page</a>
37
             
38
             
38
             {% block header %}
39
             {% block header %}
39
             {% endblock %}
40
             {% endblock %}

Loading…
Cancel
Save