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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  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.
  12. ``OSCAR_SHOP_TAGLINE``
  13. ----------------------
  14. Default: ``Domain-driven e-Commerce for Django``
  15. The tagline that is displayed next to the shop name and in the browser title.
  16. ``OSCAR_PARTNER_WRAPPERS``
  17. --------------------------
  18. Default: ``{}``
  19. This is an important setting which defines availability for each fulfillment
  20. partner. The setting should be a dict from parter name to a path to a "wrapper"
  21. class. For example::
  22. OSCAR_PARTNER_WRAPPERS = {
  23. 'Acme': 'myproject.partners.AcmeWrapper'
  24. 'Omnicorp': 'myproject.partners.OmnicorpWrapper'
  25. }
  26. The wrapper class should subclass ``oscar.apps.partner.wrappers.DefaultWrapper``
  27. and override the appropriate methods to control availability behaviour.
  28. ``OSCAR_RECENTLY_VIEWED_PRODUCTS``
  29. ----------------------------------
  30. Default: 20
  31. The number of recently viewed products to store.
  32. ``OSCAR_PRODUCTS_PER_PAGE``
  33. ---------------------------
  34. Default: 20
  35. The number of products to paginate by.
  36. ``OSCAR_SEARCH_SUGGEST_LIMIT``
  37. ------------------------------
  38. Default: 10
  39. The number of suggestions that the search 'suggest' function should return
  40. at maximum.
  41. ``OSCAR_PROMOTION_POSITIONS``
  42. -----------------------------
  43. Default::
  44. OSCAR_PROMOTION_POSITIONS = (('page', 'Page'),
  45. ('right', 'Right-hand sidebar'),
  46. ('left', 'Left-hand sidebar'))
  47. The choice of display locations available when editing a promotion. Only
  48. useful when using a new set of templates.
  49. ``OSCAR_PROMOTION_MERCHANDISING_BLOCK_TYPES``
  50. ---------------------------------------------
  51. Default::
  52. COUNTDOWN, LIST, SINGLE_PRODUCT, TABBED_BLOCK = (
  53. 'Countdown', 'List', 'SingleProduct', 'TabbedBlock')
  54. OSCAR_PROMOTION_MERCHANDISING_BLOCK_TYPES = (
  55. (COUNTDOWN, "Vertical list"),
  56. (LIST, "Horizontal list"),
  57. (TABBED_BLOCK, "Tabbed block"),
  58. (SINGLE_PRODUCT, "Single product"),
  59. )
  60. Defines the available promotion block types that can be used in Oscar.
  61. ``OSCAR_DASHBOARD_NAVIGATION``
  62. ------------------------------
  63. Default: see ``oscar.defaults`` (too long to include here).
  64. A list of dashboard navigation elements.
  65. Order settings
  66. ==============
  67. ``OSCAR_INITIAL_ORDER_STATUS``
  68. ------------------------------
  69. The initial status used when a new order is submitted. This has to be a status
  70. that is defined in the ``OSCAR_ORDER_STATUS_PIPELINE``.
  71. ``OSCAR_INITIAL_LINE_STATUS``
  72. -----------------------------
  73. The status assigned to a line item when it is created as part of an new order. It
  74. has to be a status defined in ``OSCAR_ORDER_STATUS_PIPELINE``.
  75. ``OSCAR_ORDER_STATUS_PIPELINE``
  76. -------------------------------
  77. Default: ``{}``
  78. The pipeline defines the statuses that an order or line item can have and what
  79. transitions are allowed in any given status. The pipeline is defined as a
  80. dictionary where the keys are the available statuses. Allowed transitions are
  81. defined as iterable values for the corresponding status.
  82. A sample pipeline (as used in the Oscar sandbox) might look like this::
  83. OSCAR_INITIAL_ORDER_STATUS = 'Pending'
  84. OSCAR_INITIAL_LINE_STATUS = 'Pending'
  85. OSCAR_ORDER_STATUS_PIPELINE = {
  86. 'Pending': ('Being processed', 'Cancelled',),
  87. 'Being processed': ('Processed', 'Cancelled',),
  88. 'Cancelled': (),
  89. }
  90. ``OSCAR_ORDER_STATUS_CASCADE``
  91. ------------------------------
  92. This defines a mapping of status changes for order lines which 'cascade' down
  93. from an order status change.
  94. For example::
  95. OSCAR_ORDER_STATUS_CASCADE = {
  96. 'Being processed': 'In progress'
  97. }
  98. With this mapping, when an order has it's status set to 'Being processed', all
  99. lines within it have their status set to 'In progress'. In a sense, the status
  100. change cascades down to the related objects.
  101. Note that this cascade ignores restrictions from the
  102. ``OSCAR_LINE_STATUS_PIPELINE``.
  103. ``OSCAR_LINE_STATUS_PIPELINE``
  104. ------------------------------
  105. Default: ``{}``
  106. Same as ``OSCAR_ORDER_STATUS_PIPELINE`` but for lines.
  107. Checkout settings
  108. =================
  109. ``OSCAR_ALLOW_ANON_CHECKOUT``
  110. -----------------------------
  111. Default: ``False``
  112. Specifies if an anonymous user can buy products without creating an account
  113. first. If set to ``False`` users are required to authenticate before they can
  114. checkout (using Oscar's default checkout views).
  115. ``OSCAR_REQUIRED_ADDRESS_FIELDS``
  116. ---------------------------------
  117. Default: ``('first_name', 'last_name', 'line1', 'city', 'postcode', 'country')``
  118. List of form fields that a user has to fill out to validate an address field.
  119. Review settings
  120. ===============
  121. ``OSCAR_ALLOW_ANON_REVIEWS``
  122. ----------------------------
  123. Default: ``True``
  124. This setting defines whether an anonymous user can create a review for
  125. a product without registering first. If it is set to ``True`` anonymous
  126. users can create product reviews.
  127. ``OSCAR_MODERATE_REVIEWS``
  128. --------------------------
  129. Default: ``False``
  130. This defines whether reviews have to be moderated before they are publicly
  131. available. If set to ``False`` a review created by a customer is immediately
  132. visible on the product page.
  133. Communication settings
  134. ======================
  135. ``OSCAR_EAGER_ALERTS``
  136. ----------------------
  137. Default: ``True``
  138. This enables sending alert notifications/emails instantly when products get
  139. back in stock by listening to stock record update signals this might impact
  140. performance for large numbers stock record updates.
  141. Alternatively, the management command ``oscar_send_alerts`` can be used to
  142. run periodically, e.g. as a cronjob. In this case instant alerts should be
  143. disabled.
  144. ``OSCAR_SEND_REGISTRATION_EMAIL``
  145. ---------------------------------
  146. Default: ``True``
  147. Sending out *welcome* messages to a user after they have registered on the
  148. site can be enabled or disabled using this setting. Setting it to ``True``
  149. will send out emails on registration.
  150. ``OSCAR_FROM_EMAIL``
  151. --------------------
  152. Default: ``oscar@example.com``
  153. The email address used as the sender for all communication events and emails
  154. handled by Oscar.
  155. ``OSCAR_STATIC_BASE_URL``
  156. -------------------------
  157. Default: ``None``
  158. A URL which is passed into the templates for communication events. It is not
  159. used in Oscar's default templates but could be used to include static assets
  160. (eg images) in a HTML email template.
  161. Offer settings
  162. ==============
  163. ``OSCAR_OFFER_BLACKLIST_PRODUCT``
  164. ---------------------------------
  165. Default: ``None``
  166. A function which takes a product as its sole parameter and returns a boolean
  167. indicating if the product is blacklisted from offers or not.
  168. Example::
  169. from decimal import Decimal as D
  170. def is_expensive(product):
  171. if product.has_stockrecord:
  172. return product.stockrecord.price_incl_tax < D('1000.00')
  173. return False
  174. # Don't allow expensive products to be in offers
  175. OSCAR_OFFER_BLACKLIST_PRODUCT = is_expensive
  176. ``OSCAR_OFFER_ROUNDING_FUNCTION``
  177. ---------------------------------
  178. Default: Round down to the nearest hundredth of a unit using ``decimal.Decimal.quantize``
  179. A function responsible for rounding decimal amounts when offer discount
  180. calculations don't lead to legitimate currency values.
  181. Basket settings
  182. ===============
  183. ``OSCAR_BASKET_COOKIE_LIFETIME``
  184. --------------------------------
  185. Default: 604800 (1 week in seconds)
  186. The time to live for the basket cookie in seconds.
  187. ``OSCAR_MAX_BASKET_QUANTITY_THRESHOLD``
  188. ---------------------------------------
  189. Default: ``None``
  190. The maximum number of products that can be added to a basket at once.
  191. ``OSCAR_BASKET_COOKIE_OPEN``
  192. ----------------------------
  193. Default: ``oscar_open_basket``
  194. ``OSCAR_BASKET_COOKIE_SAVED``
  195. -----------------------------
  196. Default: ``oscar_saved_basket``
  197. Currency settings
  198. =================
  199. ``OSCAR_DEFAULT_CURRENCY``
  200. --------------------------
  201. Default: ``GBP``
  202. This should be the symbol of the currency you wish Oscar to use by default.
  203. This will be used by the currency templatetag.
  204. ``OSCAR_CURRENCY_LOCALE``
  205. -------------------------
  206. Default: ``None``
  207. This can be used to customise currency formatting. The value will be passed to
  208. the ``format_currency`` function from the `Babel library`_.
  209. .. _`Babel library`: http://babel.edgewall.org/wiki/ApiDocs/0.9/babel.numbers#babel.numbers:format_decimal
  210. ``OSCAR_CURRENCY_FORMAT``
  211. -------------------------
  212. Default: ``None``
  213. This can be used to customise currency formatting. The value will be passed to
  214. the ``format_currency`` function from the Babel library.
  215. Upload/media settings
  216. =====================
  217. ``OSCAR_IMAGE_FOLDER``
  218. ----------------------
  219. Default: ``images/products/%Y/%m/``
  220. The location within the ``MEDIA_ROOT`` folder that is used to store product images.
  221. The folder name can contain date format strings as described in the `Django Docs`_.
  222. .. _`Django Docs`: https://docs.djangoproject.com/en/dev/ref/models/fields/#filefield
  223. ``OSCAR_PROMOTION_FOLDER``
  224. --------------------------
  225. Default: ``images/promotions/``
  226. The folder within ``MEDIA_ROOT`` used for uploaded promotion images.
  227. ``OSCAR_MISSING_IMAGE_URL``
  228. ---------------------------
  229. Default: ``image_not_found.jpg``
  230. Copy this image from ``oscar/static/img`` to your ``MEDIA_ROOT`` folder. It needs to
  231. be there so Sorl can resize it.
  232. ``OSCAR_UPLOAD_ROOT``
  233. ---------------------
  234. Default: ``/tmp``
  235. The folder is used to temporarily hold uploaded files until they are processed.
  236. Such files should always be deleted afterwards.
  237. Slug settings
  238. =============
  239. ``OSCAR_SLUG_MAP``
  240. ------------------
  241. Default: ``None``
  242. A dictionary to map strings to more readable versions for including in URL
  243. slugs. This mapping is appled before the slugify function.
  244. This is useful when names contain characters which would normally be
  245. stripped. For instance::
  246. OSCAR_SLUG_MAP = {
  247. 'c++': 'cpp',
  248. 'f#': 'fshared',
  249. }
  250. ``OSCAR_SLUG_FUNCTION``
  251. -----------------------
  252. Default: ``django.template.defaultfilters.slugify``
  253. The slugify function to use.
  254. Example::
  255. def some_slugify(value)
  256. pass
  257. OSCAR_SLUG_FUNCTION = some_slugify
  258. ``OSCAR_SLUG_BLACKLIST``
  259. ------------------------
  260. Default: ``None``
  261. A list of words to exclude from slugs.
  262. Example::
  263. OSCAR_SLUG_BLACKLIST = ['the', 'a', 'but']
  264. Misc settings
  265. =============
  266. ``OSCAR_COOKIES_DELETE_ON_LOGOUT``
  267. ----------------------------------
  268. Default: ``['oscar_recently_viewed_products',]``
  269. Which cookies to delete automatically when the user logs out.