Przeglądaj źródła

Added defaults file for settings

master
David Winterbottom 14 lat temu
rodzic
commit
22e4819458

+ 1
- 4
examples/vanilla/settings.py Wyświetl plik

@@ -205,11 +205,8 @@ INSTALLED_APPS = (
205 205
 LOGIN_REDIRECT_URL = '/shop/accounts/profile/'
206 206
 APPEND_SLASH = True
207 207
 
208
-# Oscar settings
209
-OSCAR_DEFAULT_CURRENCY = 'GBP'
208
+from oscar.defaults import *
210 209
 
211
-# Max number of products to keep on the user's history
212
-OSCAR_RECENTLY_VIEWED_PRODUCTS = 4
213 210
 
214 211
 # Haystack settings
215 212
 HAYSTACK_SITECONF = 'oscar.search_sites'

+ 4
- 6
oscar/apps/basket/factory.py Wyświetl plik

@@ -6,12 +6,10 @@ from oscar.core.loading import import_module
6 6
 basket_models = import_module('basket.models', ['Basket', 'Line'])
7 7
 offer_utils = import_module('offer.utils', ['Applicator'])
8 8
 
9
-# Cookie keys
10
-COOKIE_KEY_OPEN_BASKET = 'oscar_open_basket'
11
-COOKIE_KEY_SAVED_BASKET = 'oscar_saved_basket'
12
-
13
-    # The lifetime for the basket cookie can be set in settings.py
14
-COOKIE_LIFETIME = getattr(settings, 'settings.OSCAR_BASKET_COOKIE_LIFETIME', 7*24*60*60)
9
+# Basket settings
10
+COOKIE_KEY_OPEN_BASKET = settings.OSCAR_BASKET_COOKIE_OPEN
11
+COOKIE_KEY_SAVED_BASKET = settings.OSCAR_BASKET_COOKIE_SAVED
12
+COOKIE_LIFETIME = settings.OSCAR_BASKET_COOKIE_LIFETIME
15 13
 
16 14
 
17 15
 class BasketFactory(object):

+ 1
- 1
oscar/apps/customer/history_helpers.py Wyświetl plik

@@ -6,7 +6,7 @@ from django.conf import settings
6 6
 from oscar.core.loading import import_module
7 7
 product_signals = import_module('product.signals', ['product_viewed'])
8 8
 
9
-MAX_PRODUCTS = getattr(settings, 'OSCAR_RECENTLY_VIEWED_PRODUCTS', 5)
9
+MAX_PRODUCTS = settings.OSCAR_RECENTLY_VIEWED_PRODUCTS
10 10
 
11 11
 # Helpers
12 12
 

+ 2
- 2
oscar/apps/promotions/abstract_models.py Wyświetl plik

@@ -4,8 +4,8 @@ from django.utils.translation import ugettext as _
4 4
 from django.core.urlresolvers import reverse
5 5
 from django.core.exceptions import ValidationError
6 6
 
7
-BANNER_FOLDER = getattr(settings, 'OSCAR_BANNER_FOLDER', 'images/promotions/banners')
8
-POD_FOLDER = getattr(settings, 'OSCAR_POD_FOLDER', 'images/promotions/pods')
7
+BANNER_FOLDER = settings.OSCAR_BANNER_FOLDER
8
+POD_FOLDER = settings.OSCAR_POD_FOLDER
9 9
 
10 10
 BANNER, LEFT_POD, RIGHT_POD, RAW_HTML = ('Banner', 'Left pod', 'Right pod', 'Raw HTML')
11 11
 POSITION_CHOICES = (

+ 1
- 1
oscar/apps/search/views.py Wyświetl plik

@@ -18,7 +18,7 @@ class Suggestions(View):
18 18
     jQuery autocomplete)
19 19
     """
20 20
 
21
-    suggest_limit = getattr(settings, 'OSCAR_SEARCH_SUGGEST_LIMIT', 10)
21
+    suggest_limit = settings.OSCAR_SEARCH_SUGGEST_LIMIT
22 22
 
23 23
     def get(self, request):
24 24
         context = self.get_context_data()

+ 18
- 0
oscar/defaults.py Wyświetl plik

@@ -0,0 +1,18 @@
1
+# Basket settings
2
+OSCAR_BASKET_COOKIE_LIFETIME = 7*24*60*60
3
+OSCAR_BASKET_COOKIE_OPEN = 'oscar_open_basket'
4
+OSCAR_BASKET_COOKIE_SAVED = 'oscar_saved_basket'
5
+
6
+# Currency
7
+OSCAR_DEFAULT_CURRENCY = 'GBP'
8
+
9
+# Max number of products to keep on the user's history
10
+OSCAR_RECENTLY_VIEWED_PRODUCTS = 4
11
+
12
+# Image paths
13
+OSCAR_IMAGE_FOLDER = 'images/products/%Y/%m/'
14
+OSCAR_BANNER_FOLDER = 'images/promotions/banners'
15
+OSCAR_POD_FOLDER = 'images/promotions/pods'
16
+
17
+# Search settings
18
+OSCAR_SEARCH_SUGGEST_LIMIT = 10

Ładowanie…
Anuluj
Zapisz