Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

defaults.py 7.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. from collections import OrderedDict
  2. from django.urls import reverse_lazy
  3. from django.utils.translation import gettext_lazy as _
  4. OSCAR_SHOP_NAME = 'Oscar'
  5. OSCAR_SHOP_TAGLINE = ''
  6. OSCAR_HOMEPAGE = reverse_lazy('catalogue:index')
  7. # Dynamic class loading
  8. OSCAR_DYNAMIC_CLASS_LOADER = 'oscar.core.loading.default_class_loader'
  9. # Basket settings
  10. OSCAR_BASKET_COOKIE_LIFETIME = 7 * 24 * 60 * 60
  11. OSCAR_BASKET_COOKIE_OPEN = 'oscar_open_basket'
  12. OSCAR_BASKET_COOKIE_SECURE = False
  13. OSCAR_MAX_BASKET_QUANTITY_THRESHOLD = 10000
  14. # Recently-viewed products
  15. OSCAR_RECENTLY_VIEWED_COOKIE_LIFETIME = 7 * 24 * 60 * 60
  16. OSCAR_RECENTLY_VIEWED_COOKIE_NAME = 'oscar_history'
  17. OSCAR_RECENTLY_VIEWED_COOKIE_SECURE = False
  18. OSCAR_RECENTLY_VIEWED_PRODUCTS = 20
  19. # Currency
  20. OSCAR_DEFAULT_CURRENCY = 'GBP'
  21. # Paths
  22. OSCAR_IMAGE_FOLDER = 'images/products/%Y/%m/'
  23. OSCAR_DELETE_IMAGE_FILES = True
  24. # Copy this image from oscar/static/img to your MEDIA_ROOT folder.
  25. # It needs to be there so Sorl can resize it.
  26. OSCAR_MISSING_IMAGE_URL = 'image_not_found.jpg'
  27. # Address settings
  28. OSCAR_REQUIRED_ADDRESS_FIELDS = ('first_name', 'last_name', 'line1',
  29. 'line4', 'postcode', 'country')
  30. # Pagination settings
  31. OSCAR_OFFERS_PER_PAGE = 20
  32. OSCAR_PRODUCTS_PER_PAGE = 20
  33. OSCAR_REVIEWS_PER_PAGE = 20
  34. OSCAR_NOTIFICATIONS_PER_PAGE = 20
  35. OSCAR_EMAILS_PER_PAGE = 20
  36. OSCAR_ORDERS_PER_PAGE = 20
  37. OSCAR_ADDRESSES_PER_PAGE = 20
  38. OSCAR_STOCK_ALERTS_PER_PAGE = 20
  39. OSCAR_DASHBOARD_ITEMS_PER_PAGE = 20
  40. # Checkout
  41. OSCAR_ALLOW_ANON_CHECKOUT = False
  42. # Reviews
  43. OSCAR_ALLOW_ANON_REVIEWS = True
  44. OSCAR_MODERATE_REVIEWS = False
  45. # Accounts
  46. OSCAR_ACCOUNTS_REDIRECT_URL = 'customer:profile-view'
  47. # This enables sending alert notifications/emails instantly when products get
  48. # back in stock by listening to stock record update signals.
  49. # This might impact performance for large numbers of stock record updates.
  50. # Alternatively, the management command ``oscar_send_alerts`` can be used to
  51. # run periodically, e.g. as a cron job. In this case eager alerts should be
  52. # disabled.
  53. OSCAR_EAGER_ALERTS = True
  54. # Registration
  55. OSCAR_SEND_REGISTRATION_EMAIL = True
  56. OSCAR_FROM_EMAIL = 'oscar@example.com'
  57. # Slug handling
  58. OSCAR_SLUG_FUNCTION = 'oscar.core.utils.default_slugifier'
  59. OSCAR_SLUG_MAP = {}
  60. OSCAR_SLUG_BLACKLIST = []
  61. OSCAR_SLUG_ALLOW_UNICODE = False
  62. # Cookies
  63. OSCAR_COOKIES_DELETE_ON_LOGOUT = ['oscar_recently_viewed_products', ]
  64. # Offers
  65. OSCAR_OFFERS_INCL_TAX = False
  66. # Hidden Oscar features, e.g. wishlists or reviews
  67. OSCAR_HIDDEN_FEATURES = []
  68. # Menu structure of the dashboard navigation
  69. OSCAR_DASHBOARD_NAVIGATION = [
  70. {
  71. 'label': _('Dashboard'),
  72. 'icon': 'fas fa-list',
  73. 'url_name': 'dashboard:index',
  74. },
  75. {
  76. 'label': _('Catalogue'),
  77. 'icon': 'fas fa-sitemap',
  78. 'children': [
  79. {
  80. 'label': _('Products'),
  81. 'url_name': 'dashboard:catalogue-product-list',
  82. },
  83. {
  84. 'label': _('Product Types'),
  85. 'url_name': 'dashboard:catalogue-class-list',
  86. },
  87. {
  88. 'label': _('Categories'),
  89. 'url_name': 'dashboard:catalogue-category-list',
  90. },
  91. {
  92. 'label': _('Ranges'),
  93. 'url_name': 'dashboard:range-list',
  94. },
  95. {
  96. 'label': _('Low stock alerts'),
  97. 'url_name': 'dashboard:stock-alert-list',
  98. },
  99. {
  100. 'label': _('Options'),
  101. 'url_name': 'dashboard:catalogue-option-list',
  102. },
  103. ]
  104. },
  105. {
  106. 'label': _('Fulfilment'),
  107. 'icon': 'fas fa-shopping-cart',
  108. 'children': [
  109. {
  110. 'label': _('Orders'),
  111. 'url_name': 'dashboard:order-list',
  112. },
  113. {
  114. 'label': _('Statistics'),
  115. 'url_name': 'dashboard:order-stats',
  116. },
  117. {
  118. 'label': _('Partners'),
  119. 'url_name': 'dashboard:partner-list',
  120. },
  121. # The shipping method dashboard is disabled by default as it might
  122. # be confusing. Weight-based shipping methods aren't hooked into
  123. # the shipping repository by default (as it would make
  124. # customising the repository slightly more difficult).
  125. # {
  126. # 'label': _('Shipping charges'),
  127. # 'url_name': 'dashboard:shipping-method-list',
  128. # },
  129. ]
  130. },
  131. {
  132. 'label': _('Customers'),
  133. 'icon': 'fas fa-users',
  134. 'children': [
  135. {
  136. 'label': _('Customers'),
  137. 'url_name': 'dashboard:users-index',
  138. },
  139. {
  140. 'label': _('Stock alert requests'),
  141. 'url_name': 'dashboard:user-alert-list',
  142. },
  143. ]
  144. },
  145. {
  146. 'label': _('Offers'),
  147. 'icon': 'fas fa-bullhorn',
  148. 'children': [
  149. {
  150. 'label': _('Offers'),
  151. 'url_name': 'dashboard:offer-list',
  152. },
  153. {
  154. 'label': _('Vouchers'),
  155. 'url_name': 'dashboard:voucher-list',
  156. },
  157. {
  158. 'label': _('Voucher Sets'),
  159. 'url_name': 'dashboard:voucher-set-list',
  160. },
  161. ],
  162. },
  163. {
  164. 'label': _('Content'),
  165. 'icon': 'fas fa-folder',
  166. 'children': [
  167. {
  168. 'label': _('Pages'),
  169. 'url_name': 'dashboard:page-list',
  170. },
  171. {
  172. 'label': _('Email templates'),
  173. 'url_name': 'dashboard:comms-list',
  174. },
  175. {
  176. 'label': _('Reviews'),
  177. 'url_name': 'dashboard:reviews-list',
  178. },
  179. ]
  180. },
  181. {
  182. 'label': _('Reports'),
  183. 'icon': 'fas fa-chart-bar',
  184. 'url_name': 'dashboard:reports-index',
  185. },
  186. ]
  187. OSCAR_DASHBOARD_DEFAULT_ACCESS_FUNCTION = 'oscar.apps.dashboard.nav.default_access_fn' # noqa
  188. # Search facets
  189. OSCAR_SEARCH_FACETS = {
  190. 'fields': OrderedDict([
  191. # The key for these dicts will be used when passing facet data
  192. # to the template. Same for the 'queries' dict below.
  193. ('product_class', {'name': _('Type'), 'field': 'product_class'}),
  194. ('rating', {'name': _('Rating'), 'field': 'rating'}),
  195. # You can specify an 'options' element that will be passed to the
  196. # SearchQuerySet.facet() call.
  197. # For instance, with Elasticsearch backend, 'options': {'order': 'term'}
  198. # will sort items in a facet by title instead of number of items.
  199. # It's hard to get 'missing' to work
  200. # correctly though as of Solr's hilarious syntax for selecting
  201. # items without a specific facet:
  202. # http://wiki.apache.org/solr/SimpleFacetParameters#facet.method
  203. # 'options': {'missing': 'true'}
  204. ]),
  205. 'queries': OrderedDict([
  206. ('price_range',
  207. {
  208. 'name': _('Price range'),
  209. 'field': 'price',
  210. 'queries': [
  211. # This is a list of (name, query) tuples where the name will
  212. # be displayed on the front-end.
  213. (_('0 to 20'), '[0 TO 20]'),
  214. (_('20 to 40'), '[20 TO 40]'),
  215. (_('40 to 60'), '[40 TO 60]'),
  216. (_('60+'), '[60 TO *]'),
  217. ]
  218. }),
  219. ]),
  220. }
  221. OSCAR_PRODUCT_SEARCH_HANDLER = None
  222. OSCAR_THUMBNAILER = 'oscar.core.thumbnails.SorlThumbnail'
  223. OSCAR_URL_SCHEMA = 'http'
  224. OSCAR_SAVE_SENT_EMAILS_TO_DB = True