瀏覽代碼

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

master
David Winterbottom 15 年之前
父節點
當前提交
e7ccabfbca
共有 3 個文件被更改,包括 18 次插入6 次删除
  1. 9
    3
      examples/defaultshop/settings.py
  2. 8
    3
      oscar/marketing/context_processors.py
  3. 1
    0
      oscar/templates/layout.html

+ 9
- 3
examples/defaultshop/settings.py 查看文件

@@ -72,9 +72,15 @@ TEMPLATE_LOADERS = (
72 72
 )
73 73
 
74 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 85
 MIDDLEWARE_CLASSES = (
80 86
     'django.middleware.common.CommonMiddleware',

+ 8
- 3
oscar/marketing/context_processors.py 查看文件

@@ -5,9 +5,14 @@ from oscar.services import import_module
5 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 17
     # Look for a banner
13 18
     try:

+ 1
- 0
oscar/templates/layout.html 查看文件

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

Loading…
取消
儲存