|
|
@@ -5,7 +5,6 @@ from django.utils.translation import ugettext_lazy as _
|
|
5
|
5
|
|
|
6
|
6
|
from oscar.forms.fields import ExtendedURLField
|
|
7
|
7
|
from oscar.core.loading import get_classes
|
|
8
|
|
-from oscar.apps.promotions.conf import PROMOTION_CLASSES
|
|
9
|
8
|
|
|
10
|
9
|
RawHTML, SingleProduct, PagePromotion, HandPickedProductList, OrderedProduct = get_classes('promotions.models',
|
|
11
|
10
|
['RawHTML', 'SingleProduct', 'PagePromotion', 'HandPickedProductList',
|
|
|
@@ -37,10 +36,11 @@ OrderedProductFormSet = inlineformset_factory(HandPickedProductList,
|
|
37
|
36
|
|
|
38
|
37
|
|
|
39
|
38
|
class PagePromotionForm(forms.ModelForm):
|
|
40
|
|
- page_url = ExtendedURLField(label=_("URL"))
|
|
41
|
|
- position = forms.CharField(widget=forms.Select(choices=settings.OSCAR_PROMOTION_POSITIONS),
|
|
42
|
|
- label=_("Position"),
|
|
43
|
|
- help_text=_("Where in the page this content block will appear"))
|
|
|
39
|
+ page_url = ExtendedURLField(label=_("URL"), verify_exists=True)
|
|
|
40
|
+ position = forms.CharField(
|
|
|
41
|
+ widget=forms.Select(choices=settings.PROMOTION_POSITIONS),
|
|
|
42
|
+ label=_("Position"),
|
|
|
43
|
+ help_text=_("Where in the page this content block will appear"))
|
|
44
|
44
|
|
|
45
|
45
|
class Meta:
|
|
46
|
46
|
model = PagePromotion
|
|
|
@@ -49,7 +49,6 @@ class PagePromotionForm(forms.ModelForm):
|
|
49
|
49
|
def clean_page_url(self):
|
|
50
|
50
|
page_url = self.cleaned_data.get('page_url')
|
|
51
|
51
|
if (page_url and page_url.startswith('/') and
|
|
52
|
|
- not page_url.endswith('/')):
|
|
|
52
|
+ not page_url.endswith('/')):
|
|
53
|
53
|
page_url += '/'
|
|
54
|
54
|
return page_url
|
|
55
|
|
-
|