You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

settings.rst 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  1. ==============
  2. Oscar settings
  3. ==============
  4. This is a comprehensive list of all the settings Oscar provides. All settings
  5. are optional.
  6. Display settings
  7. ================
  8. ``OSCAR_SHOP_NAME``
  9. -------------------
  10. Default: ``'Oscar'``
  11. The name of your e-commerce shop site. This is shown as the main logo within
  12. the default templates.
  13. ``OSCAR_SHOP_TAGLINE``
  14. ----------------------
  15. Default: ``''``
  16. The tagline that is displayed next to the shop name and in the browser title.
  17. ``OSCAR_HOMEPAGE``
  18. ------------------
  19. Default: ``reverse_lazy('promotions:home')``
  20. URL of home page of your site. This value is used for `Home` link in
  21. navigation and redirection page after logout. Useful if you use a different app
  22. to serve your homepage.
  23. ``OSCAR_ACCOUNTS_REDIRECT_URL``
  24. -------------------------------
  25. Default: ``'customer:profile-view'``
  26. Oscar has a view that gets called any time the user clicks on 'My account' or
  27. similar. By default it's a dumb redirect to the view configured with this
  28. setting. But you could also override the view to display a more useful
  29. account summary page or such like.
  30. ``OSCAR_RECENTLY_VIEWED_PRODUCTS``
  31. ----------------------------------
  32. Default: 20
  33. The number of recently viewed products to store.
  34. ``OSCAR_RECENTLY_VIEWED_COOKIE_LIFETIME``
  35. -----------------------------------------
  36. Default: 604800 (1 week in seconds)
  37. The time to live for the cookie in seconds.
  38. ``OSCAR_RECENTLY_VIEWED_COOKIE_NAME``
  39. -------------------------------------
  40. Default: ``'oscar_history'``
  41. The name of the cookie for showing recently viewed products.
  42. Pagination
  43. ----------
  44. There are a number of settings that control pagination in Oscar's views. They
  45. all default to 20.
  46. - ``OSCAR_PRODUCTS_PER_PAGE``
  47. - ``OSCAR_OFFERS_PER_PAGE``
  48. - ``OSCAR_REVIEWS_PER_PAGE``
  49. - ``OSCAR_NOTIFICATIONS_PER_PAGE``
  50. - ``OSCAR_EMAILS_PER_PAGE``
  51. - ``OSCAR_ORDERS_PER_PAGE``
  52. - ``OSCAR_ADDRESSES_PER_PAGE``
  53. - ``OSCAR_STOCK_ALERTS_PER_PAGE``
  54. - ``OSCAR_DASHBOARD_ITEMS_PER_PAGE``
  55. .. _oscar_search_facets:
  56. ``OSCAR_SEARCH_FACETS``
  57. -----------------------
  58. A dictionary that specifies the facets to use with the search backend. It
  59. needs to be a dict with keys ``fields`` and ``queries`` for field- and
  60. query-type facets. The default is::
  61. OSCAR_SEARCH_FACETS = {
  62. 'fields': OrderedDict([
  63. ('product_class', {'name': _('Type'), 'field': 'product_class'}),
  64. ('rating', {'name': _('Rating'), 'field': 'rating'}),
  65. ]),
  66. 'queries': OrderedDict([
  67. ('price_range',
  68. {
  69. 'name': _('Price range'),
  70. 'field': 'price',
  71. 'queries': [
  72. # This is a list of (name, query) tuples where the name will
  73. # be displayed on the front-end.
  74. (_('0 to 20'), u'[0 TO 20]'),
  75. (_('20 to 40'), u'[20 TO 40]'),
  76. (_('40 to 60'), u'[40 TO 60]'),
  77. (_('60+'), u'[60 TO *]'),
  78. ]
  79. }),
  80. ]),
  81. }
  82. ``OSCAR_PRODUCT_SEARCH_HANDLER``
  83. -----------------------
  84. The search handler to be used in the product list views. If ``None``,
  85. Oscar tries to guess the correct handler based on your Haystack settings.
  86. Default::
  87. None
  88. ``OSCAR_PROMOTION_POSITIONS``
  89. -----------------------------
  90. Default::
  91. OSCAR_PROMOTION_POSITIONS = (('page', 'Page'),
  92. ('right', 'Right-hand sidebar'),
  93. ('left', 'Left-hand sidebar'))
  94. The choice of display locations available when editing a promotion. Only
  95. useful when using a new set of templates.
  96. ``OSCAR_PROMOTION_MERCHANDISING_BLOCK_TYPES``
  97. ---------------------------------------------
  98. Default::
  99. COUNTDOWN, LIST, SINGLE_PRODUCT, TABBED_BLOCK = (
  100. 'Countdown', 'List', 'SingleProduct', 'TabbedBlock')
  101. OSCAR_PROMOTION_MERCHANDISING_BLOCK_TYPES = (
  102. (COUNTDOWN, "Vertical list"),
  103. (LIST, "Horizontal list"),
  104. (TABBED_BLOCK, "Tabbed block"),
  105. (SINGLE_PRODUCT, "Single product"),
  106. )
  107. Defines the available promotion block types that can be used in Oscar.
  108. .. _OSCAR_DASHBOARD_NAVIGATION:
  109. ``OSCAR_DASHBOARD_NAVIGATION``
  110. ------------------------------
  111. Default: see ``oscar.defaults`` (too long to include here).
  112. A list of dashboard navigation elements. Usage is explained in
  113. :doc:`/howto/how_to_configure_the_dashboard_navigation`.
  114. ``OSCAR_DASHBOARD_DEFAULT_ACCESS_FUNCTION``
  115. -------------------------------------------
  116. Default: ``'oscar.apps.dashboard.nav.default_access_fn'``
  117. ``OSCAR_DASHBOARD_NAVIGATION`` allows passing an access function for each node
  118. which is used to determine whether to show the node for a specific user or not.
  119. If no access function is defined, the function specified here is used.
  120. The default function integrates with the permission-based dashboard and shows
  121. the node if the user will be able to access it. That should be sufficient for
  122. most cases.
  123. Order settings
  124. ==============
  125. ``OSCAR_INITIAL_ORDER_STATUS``
  126. ------------------------------
  127. The initial status used when a new order is submitted. This has to be a status
  128. that is defined in the ``OSCAR_ORDER_STATUS_PIPELINE``.
  129. ``OSCAR_INITIAL_LINE_STATUS``
  130. -----------------------------
  131. The status assigned to a line item when it is created as part of an new order. It
  132. has to be a status defined in ``OSCAR_ORDER_STATUS_PIPELINE``.
  133. ``OSCAR_ORDER_STATUS_PIPELINE``
  134. -------------------------------
  135. Default: ``{}``
  136. The pipeline defines the statuses that an order or line item can have and what
  137. transitions are allowed in any given status. The pipeline is defined as a
  138. dictionary where the keys are the available statuses. Allowed transitions are
  139. defined as iterable values for the corresponding status.
  140. A sample pipeline (as used in the Oscar sandbox) might look like this::
  141. OSCAR_INITIAL_ORDER_STATUS = 'Pending'
  142. OSCAR_INITIAL_LINE_STATUS = 'Pending'
  143. OSCAR_ORDER_STATUS_PIPELINE = {
  144. 'Pending': ('Being processed', 'Cancelled',),
  145. 'Being processed': ('Processed', 'Cancelled',),
  146. 'Cancelled': (),
  147. }
  148. ``OSCAR_ORDER_STATUS_CASCADE``
  149. ------------------------------
  150. This defines a mapping of status changes for order lines which 'cascade' down
  151. from an order status change.
  152. For example::
  153. OSCAR_ORDER_STATUS_CASCADE = {
  154. 'Being processed': 'In progress'
  155. }
  156. With this mapping, when an order has it's status set to 'Being processed', all
  157. lines within it have their status set to 'In progress'. In a sense, the status
  158. change cascades down to the related objects.
  159. Note that this cascade ignores restrictions from the
  160. ``OSCAR_LINE_STATUS_PIPELINE``.
  161. ``OSCAR_LINE_STATUS_PIPELINE``
  162. ------------------------------
  163. Default: ``{}``
  164. Same as ``OSCAR_ORDER_STATUS_PIPELINE`` but for lines.
  165. Checkout settings
  166. =================
  167. ``OSCAR_ALLOW_ANON_CHECKOUT``
  168. -----------------------------
  169. Default: ``False``
  170. Specifies if an anonymous user can buy products without creating an account
  171. first. If set to ``False`` users are required to authenticate before they can
  172. checkout (using Oscar's default checkout views).
  173. ``OSCAR_REQUIRED_ADDRESS_FIELDS``
  174. ---------------------------------
  175. Default: ``('first_name', 'last_name', 'line1', 'city', 'postcode', 'country')``
  176. List of form fields that a user has to fill out to validate an address field.
  177. Review settings
  178. ===============
  179. ``OSCAR_ALLOW_ANON_REVIEWS``
  180. ----------------------------
  181. Default: ``True``
  182. This setting defines whether an anonymous user can create a review for
  183. a product without registering first. If it is set to ``True`` anonymous
  184. users can create product reviews.
  185. ``OSCAR_MODERATE_REVIEWS``
  186. --------------------------
  187. Default: ``False``
  188. This defines whether reviews have to be moderated before they are publicly
  189. available. If set to ``False`` a review created by a customer is immediately
  190. visible on the product page.
  191. Communication settings
  192. ======================
  193. ``OSCAR_EAGER_ALERTS``
  194. ----------------------
  195. Default: ``True``
  196. This enables sending alert notifications/emails instantly when products get
  197. back in stock by listening to stock record update signals this might impact
  198. performance for large numbers stock record updates.
  199. Alternatively, the management command ``oscar_send_alerts`` can be used to
  200. run periodically, e.g. as a cronjob. In this case instant alerts should be
  201. disabled.
  202. ``OSCAR_SEND_REGISTRATION_EMAIL``
  203. ---------------------------------
  204. Default: ``True``
  205. Sending out *welcome* messages to a user after they have registered on the
  206. site can be enabled or disabled using this setting. Setting it to ``True``
  207. will send out emails on registration.
  208. ``OSCAR_FROM_EMAIL``
  209. --------------------
  210. Default: ``oscar@example.com``
  211. The email address used as the sender for all communication events and emails
  212. handled by Oscar.
  213. ``OSCAR_STATIC_BASE_URL``
  214. -------------------------
  215. Default: ``None``
  216. A URL which is passed into the templates for communication events. It is not
  217. used in Oscar's default templates but could be used to include static assets
  218. (eg images) in a HTML email template.
  219. Offer settings
  220. ==============
  221. ``OSCAR_OFFER_ROUNDING_FUNCTION``
  222. ---------------------------------
  223. Default: Round down to the nearest hundredth of a unit using ``decimal.Decimal.quantize``
  224. A function responsible for rounding decimal amounts when offer discount
  225. calculations don't lead to legitimate currency values.
  226. Basket settings
  227. ===============
  228. ``OSCAR_BASKET_COOKIE_LIFETIME``
  229. --------------------------------
  230. Default: 604800 (1 week in seconds)
  231. The time to live for the basket cookie in seconds.
  232. ``OSCAR_MAX_BASKET_QUANTITY_THRESHOLD``
  233. ---------------------------------------
  234. Default: ``None``
  235. The maximum number of products that can be added to a basket at once.
  236. ``OSCAR_BASKET_COOKIE_OPEN``
  237. ----------------------------
  238. Default: ``'oscar_open_basket'``
  239. The name of the cookie for the open basket.
  240. Currency settings
  241. =================
  242. ``OSCAR_DEFAULT_CURRENCY``
  243. --------------------------
  244. Default: ``GBP``
  245. This should be the symbol of the currency you wish Oscar to use by default.
  246. This will be used by the currency templatetag.
  247. ``OSCAR_CURRENCY_FORMAT``
  248. -------------------------
  249. Default: ``None``
  250. This can be used to customise currency formatting. The value will be passed to
  251. the ``format_currency`` function from the `Babel library`_.
  252. .. _`Babel library`: http://babel.pocoo.org/docs/api/numbers/#babel.numbers.format_currency
  253. Upload/media settings
  254. =====================
  255. ``OSCAR_IMAGE_FOLDER``
  256. ----------------------
  257. Default: ``images/products/%Y/%m/``
  258. The location within the ``MEDIA_ROOT`` folder that is used to store product images.
  259. The folder name can contain date format strings as described in the `Django Docs`_.
  260. .. _`Django Docs`: https://docs.djangoproject.com/en/dev/ref/models/fields/#filefield
  261. ``OSCAR_DELETE_IMAGE_FILES``
  262. ----------------------------
  263. Default: ``True``
  264. If enabled, a ``post_delete`` hook will attempt to delete any image files and
  265. created thumbnails when a model with an ``ImageField`` is deleted. This is
  266. usually desired, but might not be what you want when using a remote storage.
  267. ``OSCAR_PROMOTION_FOLDER``
  268. --------------------------
  269. Default: ``images/promotions/``
  270. The folder within ``MEDIA_ROOT`` used for uploaded promotion images.
  271. .. _missing-image-label:
  272. ``OSCAR_MISSING_IMAGE_URL``
  273. ---------------------------
  274. Default: ``image_not_found.jpg``
  275. Copy this image from ``oscar/static/img`` to your ``MEDIA_ROOT`` folder. It needs to
  276. be there so Sorl can resize it.
  277. ``OSCAR_UPLOAD_ROOT``
  278. ---------------------
  279. Default: ``/tmp``
  280. The folder is used to temporarily hold uploaded files until they are processed.
  281. Such files should always be deleted afterwards.
  282. Slug settings
  283. =============
  284. ``OSCAR_SLUG_MAP``
  285. ------------------
  286. Default: ``{}``
  287. A dictionary to map strings to more readable versions for including in URL
  288. slugs. This mapping is appled before the slugify function.
  289. This is useful when names contain characters which would normally be
  290. stripped. For instance::
  291. OSCAR_SLUG_MAP = {
  292. 'c++': 'cpp',
  293. 'f#': 'fsharp',
  294. }
  295. ``OSCAR_SLUG_FUNCTION``
  296. -----------------------
  297. Default: ``'oscar.core.utils.default_slugifier'``
  298. The slugify function to use. Note that is used within Oscar's slugify wrapper
  299. (in ``oscar.core.utils``) which applies the custom map and blacklist. String
  300. notation is recommended, but specifying a callable is supported for
  301. backwards-compatibility.
  302. Example::
  303. # in myproject.utils
  304. def some_slugify(value):
  305. return value
  306. # in settings.py
  307. OSCAR_SLUG_FUNCTION = 'myproject.utils.some_slugify'
  308. ``OSCAR_SLUG_BLACKLIST``
  309. ------------------------
  310. Default: ``[]``
  311. A list of words to exclude from slugs.
  312. Example::
  313. OSCAR_SLUG_BLACKLIST = ['the', 'a', 'but']
  314. ``OSCAR_SLUG_ALLOW_UNICODE``
  315. ----------------------------
  316. Default: ``False``
  317. Allows to disable unicode to ASCII conversion and enable `allow_unicode` option
  318. for ``AutoSlugField``, which is supported by ``SlugField`` in Django>=1.9
  319. (https://docs.djangoproject.com/es/1.9/ref/models/fields/#django.db.models.SlugField.allow_unicode).
  320. This will allow to have
  321. automatically generated unicode-containing slugs.
  322. Misc settings
  323. =============
  324. ``OSCAR_COOKIES_DELETE_ON_LOGOUT``
  325. ----------------------------------
  326. Default: ``['oscar_recently_viewed_products',]``
  327. Which cookies to delete automatically when the user logs out.