Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

settings.rst 12KB

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