Bläddra i källkod

Added single product promotion type

master
David Winterbottom 14 år sedan
förälder
incheckning
721ce2a085

+ 2
- 1
oscar/apps/promotions/admin.py Visa fil

@@ -1,7 +1,7 @@
1 1
 from django.contrib import admin
2 2
 
3 3
 from oscar.apps.promotions.models import Image, MultiImage, RawHTML, HandPickedProductList, OrderedProduct, AutomaticProductList, TabbedBlock, \
4
-                                  PagePromotion, KeywordPromotion
4
+                                  PagePromotion, KeywordPromotion, SingleProduct
5 5
 
6 6
 
7 7
 class OrderProductInline(admin.TabularInline):
@@ -33,5 +33,6 @@ admin.site.register(AutomaticProductList)
33 33
 admin.site.register(TabbedBlock)
34 34
 admin.site.register(PagePromotion, PagePromotionAdmin)
35 35
 admin.site.register(KeywordPromotion, KeywordPromotionAdmin)
36
+admin.site.register(SingleProduct)
36 37
 
37 38
 

+ 1
- 1
oscar/apps/promotions/context_processors.py Visa fil

@@ -15,7 +15,7 @@ def promotions(request):
15 15
     promotions = PagePromotion._default_manager.select_related() \
16 16
                                                .filter(page_url=request.path) \
17 17
                                                .order_by('display_order')
18
-                                                                    
18
+                                               
19 19
 
20 20
 #    if 'q' in request.GET:
21 21
 #        keyword_promotions = KeywordPromotion._default_manager.select_related().filter(keyword=request.GET['q'])

+ 11
- 0
oscar/apps/promotions/models.py Visa fil

@@ -79,6 +79,17 @@ class MultiImage(AbstractPromotion):
79 79
         return self.name
80 80
 
81 81
 
82
+class SingleProduct(AbstractPromotion):
83
+    
84
+    name = models.CharField(_("Name"), max_length=128)
85
+    product = models.ForeignKey('catalogue.Product')
86
+    description = models.TextField(_("Description"), null=True, blank=True)
87
+    date_created = models.DateTimeField(auto_now_add=True)
88
+    
89
+    def __unicode__(self):
90
+        return self.name
91
+    
92
+
82 93
 class AbstractProductList(AbstractPromotion):
83 94
     """
84 95
     Abstract superclass for promotions which are essentially a list

+ 6
- 0
oscar/templates/promotions/singleproduct.html Visa fil

@@ -0,0 +1,6 @@
1
+{% load currency_filters %}
2
+
3
+<h2>{{ promotion.name }}</h2>
4
+<p>{{ promotion.description }}</p>
5
+
6
+{{ promotion.product.title }}

Laddar…
Avbryt
Spara