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

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