Explorar el Código

Updated template tag contect to allow CSRF to be used

master
David Winterbottom hace 14 años
padre
commit
04daeeafea
Se han modificado 2 ficheros con 6 adiciones y 1 borrados
  1. 5
    1
      oscar/apps/promotions/templatetags/promotions.py
  2. 1
    0
      oscar/core/validators.py

+ 5
- 1
oscar/apps/promotions/templatetags/promotions.py Ver fichero

@@ -1,5 +1,7 @@
1 1
 from django.template import Library, Node, Variable, Context
2 2
 from django.template.loader import select_template
3
+from django.template import RequestContext
4
+
3 5
      
4 6
 register = Library()
5 7
      
@@ -11,7 +13,9 @@ class PromotionNode(Node):
11 13
     def render(self, context):
12 14
         promotion = self.promotion_var.resolve(context)
13 15
         template = select_template([promotion.template_name(), 'promotions/default.html'])
14
-        args = dict(promotion=promotion, **promotion.template_context(request=context['request']))
16
+        args = dict(promotion=promotion, 
17
+                    **promotion.template_context(request=context['request'])
18
+                    context_instance=RequestContext(context['request']))
15 19
         return template.render(Context(args))
16 20
  
17 21
 def get_promotion_html(parser, token):

+ 1
- 0
oscar/core/validators.py Ver fichero

@@ -4,6 +4,7 @@ from django.core.urlresolvers import resolve
4 4
 from django.http import Http404
5 5
 from django.utils.translation import ugettext_lazy as _
6 6
 
7
+
7 8
 class ExtendedURLValidator(validators.URLValidator):
8 9
     def __call__(self, value):
9 10
         try:

Loading…
Cancelar
Guardar