瀏覽代碼

Added defaults file for settings

master
David Winterbottom 14 年之前
父節點
當前提交
22e4819458

+ 1
- 4
examples/vanilla/settings.py 查看文件

205
 LOGIN_REDIRECT_URL = '/shop/accounts/profile/'
205
 LOGIN_REDIRECT_URL = '/shop/accounts/profile/'
206
 APPEND_SLASH = True
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
 # Haystack settings
211
 # Haystack settings
215
 HAYSTACK_SITECONF = 'oscar.search_sites'
212
 HAYSTACK_SITECONF = 'oscar.search_sites'

+ 4
- 6
oscar/apps/basket/factory.py 查看文件

6
 basket_models = import_module('basket.models', ['Basket', 'Line'])
6
 basket_models = import_module('basket.models', ['Basket', 'Line'])
7
 offer_utils = import_module('offer.utils', ['Applicator'])
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
 class BasketFactory(object):
15
 class BasketFactory(object):

+ 1
- 1
oscar/apps/customer/history_helpers.py 查看文件

6
 from oscar.core.loading import import_module
6
 from oscar.core.loading import import_module
7
 product_signals = import_module('product.signals', ['product_viewed'])
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
 # Helpers
11
 # Helpers
12
 
12
 

+ 2
- 2
oscar/apps/promotions/abstract_models.py 查看文件

4
 from django.core.urlresolvers import reverse
4
 from django.core.urlresolvers import reverse
5
 from django.core.exceptions import ValidationError
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
 BANNER, LEFT_POD, RIGHT_POD, RAW_HTML = ('Banner', 'Left pod', 'Right pod', 'Raw HTML')
10
 BANNER, LEFT_POD, RIGHT_POD, RAW_HTML = ('Banner', 'Left pod', 'Right pod', 'Raw HTML')
11
 POSITION_CHOICES = (
11
 POSITION_CHOICES = (

+ 1
- 1
oscar/apps/search/views.py 查看文件

18
     jQuery autocomplete)
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
     def get(self, request):
23
     def get(self, request):
24
         context = self.get_context_data()
24
         context = self.get_context_data()

+ 18
- 0
oscar/defaults.py 查看文件

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

Loading…
取消
儲存