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 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  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('catalogue:index')``
  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. ``OSCAR_HIDDEN_FEATURES``
  43. -------------------------
  44. Defaults: ``[]``
  45. Allows to disable particular Oscar feature in application and templates.
  46. More information in the :doc:`/howto/how_to_disable_an_app_or_feature` document.
  47. Pagination
  48. ----------
  49. There are a number of settings that control pagination in Oscar's views. They
  50. all default to 20.
  51. - ``OSCAR_PRODUCTS_PER_PAGE``
  52. - ``OSCAR_OFFERS_PER_PAGE``
  53. - ``OSCAR_REVIEWS_PER_PAGE``
  54. - ``OSCAR_NOTIFICATIONS_PER_PAGE``
  55. - ``OSCAR_EMAILS_PER_PAGE``
  56. - ``OSCAR_ORDERS_PER_PAGE``
  57. - ``OSCAR_ADDRESSES_PER_PAGE``
  58. - ``OSCAR_STOCK_ALERTS_PER_PAGE``
  59. - ``OSCAR_DASHBOARD_ITEMS_PER_PAGE``
  60. .. _oscar_search_facets:
  61. ``OSCAR_SEARCH_FACETS``
  62. -----------------------
  63. A dictionary that specifies the facets to use with the search backend. It
  64. needs to be a dict with keys ``fields`` and ``queries`` for field- and
  65. query-type facets. Field-type facets can get an 'options' element with parameters like facet
  66. sorting, filtering, etc.
  67. The default is::
  68. OSCAR_SEARCH_FACETS = {
  69. 'fields': {
  70. 'product_class': {'name': _('Type'), 'field': 'product_class'},
  71. 'rating': {'name': _('Rating'), 'field': 'rating'},
  72. },
  73. 'queries': {
  74. 'price_range': {
  75. 'name': _('Price range'),
  76. 'field': 'price',
  77. 'queries': [
  78. # This is a list of (name, query) tuples where the name will
  79. # be displayed on the front-end.
  80. (_('0 to 20'), '[0 TO 20]'),
  81. (_('20 to 40'), '[20 TO 40]'),
  82. (_('40 to 60'), '[40 TO 60]'),
  83. (_('60+'), '[60 TO *]'),
  84. ]
  85. },
  86. },
  87. }
  88. ``OSCAR_PRODUCT_SEARCH_HANDLER``
  89. --------------------------------
  90. The search handler to be used in the product list views. If ``None``,
  91. Oscar tries to guess the correct handler based on your Haystack settings.
  92. Default:: ``None``
  93. .. _OSCAR_DASHBOARD_NAVIGATION:
  94. ``OSCAR_DASHBOARD_NAVIGATION``
  95. ------------------------------
  96. Default: see ``oscar.defaults`` (too long to include here).
  97. A list of dashboard navigation elements. Usage is explained in
  98. :doc:`/howto/how_to_configure_the_dashboard_navigation`.
  99. ``OSCAR_DASHBOARD_DEFAULT_ACCESS_FUNCTION``
  100. -------------------------------------------
  101. Default: ``'oscar.apps.dashboard.nav.default_access_fn'``
  102. ``OSCAR_DASHBOARD_NAVIGATION`` allows passing an access function for each node
  103. which is used to determine whether to show the node for a specific user or not.
  104. If no access function is defined, the function specified here is used.
  105. The default function integrates with the permission-based dashboard and shows
  106. the node if the user will be able to access it. That should be sufficient for
  107. most cases.
  108. Order settings
  109. ==============
  110. ``OSCAR_INITIAL_ORDER_STATUS``
  111. ------------------------------
  112. The initial status used when a new order is submitted. This has to be a status
  113. that is defined in the ``OSCAR_ORDER_STATUS_PIPELINE``.
  114. ``OSCAR_INITIAL_LINE_STATUS``
  115. -----------------------------
  116. The status assigned to a line item when it is created as part of an new order. It
  117. has to be a status defined in ``OSCAR_LINE_STATUS_PIPELINE``.
  118. ``OSCAR_ORDER_STATUS_PIPELINE``
  119. -------------------------------
  120. Default: ``{}``
  121. The pipeline defines the statuses that an order or line item can have and what
  122. transitions are allowed in any given status. The pipeline is defined as a
  123. dictionary where the keys are the available statuses. Allowed transitions are
  124. defined as iterable values for the corresponding status.
  125. A sample pipeline (as used in the Oscar sandbox) might look like this::
  126. OSCAR_INITIAL_ORDER_STATUS = 'Pending'
  127. OSCAR_INITIAL_LINE_STATUS = 'Pending'
  128. OSCAR_ORDER_STATUS_PIPELINE = {
  129. 'Pending': ('Being processed', 'Cancelled',),
  130. 'Being processed': ('Processed', 'Cancelled',),
  131. 'Cancelled': (),
  132. }
  133. ``OSCAR_ORDER_STATUS_CASCADE``
  134. ------------------------------
  135. This defines a mapping of status changes for order lines which 'cascade' down
  136. from an order status change.
  137. For example::
  138. OSCAR_ORDER_STATUS_CASCADE = {
  139. 'Being processed': 'In progress'
  140. }
  141. With this mapping, when an order has it's status set to 'Being processed', all
  142. lines within it have their status set to 'In progress'. In a sense, the status
  143. change cascades down to the related objects.
  144. Note that this cascade ignores restrictions from the
  145. ``OSCAR_LINE_STATUS_PIPELINE``.
  146. ``OSCAR_LINE_STATUS_PIPELINE``
  147. ------------------------------
  148. Default: ``{}``
  149. Same as ``OSCAR_ORDER_STATUS_PIPELINE`` but for lines.
  150. Checkout settings
  151. =================
  152. ``OSCAR_ALLOW_ANON_CHECKOUT``
  153. -----------------------------
  154. Default: ``False``
  155. Specifies if an anonymous user can buy products without creating an account
  156. first. If set to ``False`` users are required to authenticate before they can
  157. checkout (using Oscar's default checkout views).
  158. ``OSCAR_REQUIRED_ADDRESS_FIELDS``
  159. ---------------------------------
  160. Default: ``('first_name', 'last_name', 'line1', 'line4', 'postcode', 'country')``
  161. List of form fields that a user has to fill out to validate an address field.
  162. Review settings
  163. ===============
  164. ``OSCAR_ALLOW_ANON_REVIEWS``
  165. ----------------------------
  166. Default: ``True``
  167. This setting defines whether an anonymous user can create a review for
  168. a product without registering first. If it is set to ``True`` anonymous
  169. users can create product reviews.
  170. ``OSCAR_MODERATE_REVIEWS``
  171. --------------------------
  172. Default: ``False``
  173. This defines whether reviews have to be moderated before they are publicly
  174. available. If set to ``False`` a review created by a customer is immediately
  175. visible on the product page.
  176. Communication settings
  177. ======================
  178. ``OSCAR_EAGER_ALERTS``
  179. ----------------------
  180. Default: ``True``
  181. This enables sending alert notifications/emails instantly when products get
  182. back in stock by listening to stock record update signals this might impact
  183. performance for large numbers stock record updates.
  184. Alternatively, the management command ``oscar_send_alerts`` can be used to
  185. run periodically, e.g. as a cronjob. In this case instant alerts should be
  186. disabled.
  187. ``OSCAR_SEND_REGISTRATION_EMAIL``
  188. ---------------------------------
  189. Default: ``True``
  190. Sending out *welcome* messages to a user after they have registered on the
  191. site can be enabled or disabled using this setting. Setting it to ``True``
  192. will send out emails on registration.
  193. ``OSCAR_FROM_EMAIL``
  194. --------------------
  195. Default: ``oscar@example.com``
  196. The email address used as the sender for all communication events and emails
  197. handled by Oscar.
  198. ``OSCAR_STATIC_BASE_URL``
  199. -------------------------
  200. Default: ``None``
  201. A URL which is passed into the templates for communication events. It is not
  202. used in Oscar's default templates but could be used to include static assets
  203. (e.g. images) in a HTML email template.
  204. ``OSCAR_SAVE_SENT_EMAILS_TO_DB``
  205. --------------------------------
  206. Default: ``True``
  207. Indicates if sent emails will be saved to database as instances of
  208. ``oscar.apps.communication.models.Email``.
  209. Offer settings
  210. ==============
  211. ``OSCAR_OFFER_ROUNDING_FUNCTION``
  212. ---------------------------------
  213. Default: Round down to the nearest hundredth of a unit using ``decimal.Decimal.quantize``
  214. A dotted path to a function responsible for rounding decimal amounts
  215. when offer discount calculations don't lead to legitimate currency values.
  216. ``OSCAR_OFFERS_INCL_TAX``
  217. -------------------------
  218. Default: ``False``
  219. If ``True``, offers will be applied to prices including taxes instead of on
  220. prices excluding tax. Oscar used to always calculate offers on prices excluding
  221. tax so the default is ``False``. This setting also affects the meaning of
  222. absolute prices in offers. So a flat discount of 10 pounds in an offer will
  223. be treated as 10 pounds before taxes if ``OSCAR_OFFERS_INCL_TAX`` remains
  224. ``False`` and 10 pounds after taxes if ``OSCAR_OFFERS_INCL_TAX`` is set to
  225. ``True``.
  226. ``OSCAR_OFFERS_IMPLEMENTED_TYPES``
  227. ----------------------------------
  228. Default::
  229. [
  230. 'SITE',
  231. 'VOUCHER',
  232. ]
  233. A list of values from among those in the ``offer.ConditionalOffer.TYPE_CHOICES``
  234. model attribute. The names of the model constants are used, instead of the
  235. values themselves. This setting is used to restrict the selectable offer types
  236. in the dashboard offers forms (``MetaDataForm`` and ``OfferSearchForm``), to
  237. ones that Oscar currently implements.
  238. Basket settings
  239. ===============
  240. ``OSCAR_BASKET_COOKIE_LIFETIME``
  241. --------------------------------
  242. Default: 604800 (1 week in seconds)
  243. The time to live for the basket cookie in seconds.
  244. ``OSCAR_MAX_BASKET_QUANTITY_THRESHOLD``
  245. ---------------------------------------
  246. Default: ``10000``
  247. The maximum number of products that can be added to a basket at once. Set to
  248. ``None`` to disable the basket threshold limitation.
  249. ``OSCAR_BASKET_COOKIE_OPEN``
  250. ----------------------------
  251. Default: ``'oscar_open_basket'``
  252. The name of the cookie for the open basket.
  253. Currency settings
  254. =================
  255. ``OSCAR_DEFAULT_CURRENCY``
  256. --------------------------
  257. Default: ``GBP``
  258. This should be the symbol of the currency you wish Oscar to use by default.
  259. This will be used by the currency templatetag.
  260. .. _currency-format-setting:
  261. ``OSCAR_CURRENCY_FORMAT``
  262. -------------------------
  263. Default: ``None``
  264. Dictionary with arguments for the ``format_currency`` function from the `Babel library`_.
  265. Contains next options: `format`, `format_type`, `currency_digits`.
  266. For example::
  267. OSCAR_CURRENCY_FORMAT = {
  268. 'USD': {
  269. 'currency_digits': False,
  270. 'format_type': "accounting",
  271. },
  272. 'EUR': {
  273. 'format': '#,##0\xa0¤',
  274. }
  275. }
  276. .. _`Babel library`: http://babel.pocoo.org/en/latest/api/numbers.html#babel.numbers.format_currency
  277. Upload/media settings
  278. =====================
  279. ``OSCAR_IMAGE_FOLDER``
  280. ----------------------
  281. Default: ``images/products/%Y/%m/``
  282. The location within the ``MEDIA_ROOT`` folder that is used to store product images.
  283. The folder name can contain date format strings as described in the `Django Docs`_.
  284. .. _`Django Docs`: https://docs.djangoproject.com/en/stable/ref/models/fields/#filefield
  285. ``OSCAR_DELETE_IMAGE_FILES``
  286. ----------------------------
  287. Default: ``True``
  288. If enabled, a ``post_delete`` hook will attempt to delete any image files and
  289. created thumbnails when a model with an ``ImageField`` is deleted. This is
  290. usually desired, but might not be what you want when using a remote storage.
  291. .. _missing-image-label:
  292. ``OSCAR_MISSING_IMAGE_URL``
  293. ---------------------------
  294. Default: ``image_not_found.jpg``
  295. Copy this image from ``oscar/static/img`` to your ``MEDIA_ROOT`` folder. It needs to
  296. be there so the thumbnailer can resize it.
  297. ``OSCAR_THUMBNAILER``
  298. ---------------------
  299. Default: ``'oscar.core.thumbnails.SorlThumbnail'``
  300. Thumbnailer class that will be used to generate thumbnails. Available options:
  301. ``SorlThumbnail`` and ``EasyThumbnails``. To use them ``sorl-thumbnail`` or
  302. ``easy-thumbnails`` must be installed manually or with ``pip install django-oscar[sorl-thumbnail]`` or
  303. ``pip install django-oscar[easy-thumbnails]``. Custom thumbnailer class (based on
  304. ``oscar.core.thumbnails.AbstractThumbnailer``) can be used as well.
  305. ``OSCAR_THUMBNAIL_DEBUG``
  306. -------------------------
  307. Default: Same as ``DEBUG``
  308. When set to ``True`` the ``ThumbnailNode.render`` method can raise errors. Django recommends that tags never raise errors in the ``Node.render`` method in production.
  309. Slug settings
  310. =============
  311. ``OSCAR_SLUG_FUNCTION``
  312. -----------------------
  313. Default: ``'oscar.core.utils.default_slugifier'``
  314. A dotted path to the :py:func:`slugify <oscar.core.utils.default_slugifier>` function to use.
  315. Example::
  316. # in myproject.utils
  317. def some_slugify(value, allow_unicode=False):
  318. return value
  319. # in settings.py
  320. OSCAR_SLUG_FUNCTION = 'myproject.utils.some_slugify'
  321. ``OSCAR_SLUG_MAP``
  322. ------------------
  323. Default: ``{}``
  324. A dictionary to target:replacement strings that the :py:func:`slugify <oscar.core.utils.default_slugifier>` function will
  325. apply before slugifying the value. This is useful when names contain
  326. characters which would normally be stripped. For instance::
  327. OSCAR_SLUG_MAP = {
  328. 'c++': 'cpp',
  329. 'f#': 'fsharp',
  330. }
  331. ``OSCAR_SLUG_BLACKLIST``
  332. ------------------------
  333. Default: ``[]``
  334. An iterable of words the :py:func:`slugify <oscar.core.utils.default_slugifier>` function will try to remove after the value
  335. has been slugified. Note, a word will not be removed from the slug if it would
  336. result in an empty slug.
  337. Example::
  338. # With OSCAR_SLUG_BLACKLIST = ['the']
  339. slugify('The cat')
  340. > 'cat'
  341. # With OSCAR_SLUG_BLACKLIST = ['the', 'cat']
  342. slugify('The cat')
  343. > 'cat'
  344. ``OSCAR_SLUG_ALLOW_UNICODE``
  345. ----------------------------
  346. Default: ``False``
  347. Allows Unicode characters in slugs generated by ``AutoSlugField``,
  348. which is supported by the underlying ``SlugField`` in Django>=1.9.
  349. Dynamic importer settings
  350. =========================
  351. ``OSCAR_DYNAMIC_CLASS_LOADER``
  352. ----------------------------------
  353. Default: ``oscar.core.loading.default_class_loader``
  354. A dotted path to the callable used to dynamically import classes.
  355. Misc settings
  356. =============
  357. ``OSCAR_COOKIES_DELETE_ON_LOGOUT``
  358. ----------------------------------
  359. Default: ``['oscar_recently_viewed_products',]``
  360. Which cookies to delete automatically when the user logs out.
  361. ``OSCAR_GOOGLE_ANALYTICS_ID``
  362. -----------------------------
  363. Tracking ID for Google Analytics tracking code, available as `google_analytics_id` in the template
  364. context. If setting is set, enables Universal Analytics tracking code for page views and
  365. transactions.
  366. ``OSCAR_CSV_INCLUDE_BOM``
  367. -------------------------
  368. Default: ``False``
  369. A flag to control whether Oscar's CSV writer should prepend a byte order mark
  370. (BOM) to CSV files that are encoded in UTF-8. Useful for compatibility with some
  371. CSV readers, Microsoft Excel in particular.
  372. ``OSCAR_URL_SCHEMA``
  373. --------------------
  374. Default: ``http``
  375. The schema that will be used to build absolute url in ``absolute_url`` template tag.