config_file.rst 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. Config file
  2. ===========
  3. Options available in settings.py:
  4. JET_DEFAULT_THEME
  5. -----------------
  6. Django JET allows you to change default theme. This feature is mainly used for customizing color schemes rather than
  7. making absolutely different themes. This option in fact make Django load different css styles.
  8. Possible built-in themes are:
  9. * default
  10. * green
  11. * light-violet
  12. * light-green
  13. * light-blue
  14. * light-gray
  15. To change theme use parameter:
  16. .. code:: python
  17. JET_DEFAULT_THEME = 'light-gray'
  18. JET_THEMES
  19. ----------
  20. .. image:: _static/themes.png
  21. :width: 100%
  22. You can allow your users to change admin panel color scheme. This option will add color scheme chooser to the user dropdown menu. Make ``JET_THEMES`` an empty list to disable this feature.
  23. .. code:: python
  24. JET_THEMES = [
  25. {
  26. 'theme': 'default', # theme folder name
  27. 'color': '#47bac1', # color of the theme's button in user menu
  28. 'title': 'Default' # theme title
  29. },
  30. {
  31. 'theme': 'green',
  32. 'color': '#44b78b',
  33. 'title': 'Green'
  34. },
  35. {
  36. 'theme': 'light-green',
  37. 'color': '#2faa60',
  38. 'title': 'Light Green'
  39. },
  40. {
  41. 'theme': 'light-violet',
  42. 'color': '#a464c4',
  43. 'title': 'Light Violet'
  44. },
  45. {
  46. 'theme': 'light-blue',
  47. 'color': '#5EADDE',
  48. 'title': 'Light Blue'
  49. },
  50. {
  51. 'theme': 'light-gray',
  52. 'color': '#222',
  53. 'title': 'Light Gray'
  54. }
  55. ]
  56. CUSTOM JET_THEME
  57. ----------------
  58. You are free to add your own color schemes by adding new folder to **/static/jet/css/themes/**.
  59. You can use **/jet/static/jet/css/themes/light-violet/** folder as an example (available in Django JET repository).
  60. _variables.scss contains **all** customizable variables. You'll have to compile all .scss files in theme directory
  61. to start using your own theme.
  62. COMPACT MENU
  63. ------------
  64. .. image:: _static/side_menu_compact.png
  65. :width: 100%
  66. If you don't have a lot of apps and models it can be annoying to have a two-level menu.
  67. In this case you can use menu's compact mode, which will list applications and models in the side menu without need
  68. to move pointer over applications to show models.
  69. .. code:: python
  70. JET_SIDE_MENU_COMPACT = True
  71. Default is ``False``
  72. CUSTOM MENU
  73. -----------
  74. By default JET displays all applications and it models in the side menu in the alphabetical order.
  75. To display applications and models you want or to change their order you can use ``JET_SIDE_MENU_ITEMS`` setting.
  76. .. code:: python
  77. JET_SIDE_MENU_ITEMS = [ # A list of application or custom item dicts
  78. {'label': _('General'), 'app_label': 'core', 'items': [
  79. {'name': 'help.question'},
  80. {'name': 'pages.page', 'label': _('Static page')},
  81. {'name': 'city'},
  82. {'name': 'validationcode'},
  83. {'label': _('Analytics'), 'url': 'http://example.com', 'url_blank': True},
  84. ]},
  85. {'label': _('Users'), 'items': [
  86. {'name': 'core.user'},
  87. {'name': 'auth.group'},
  88. {'name': 'core.userprofile', 'permissions': ['core.user']},
  89. ]},
  90. {'app_label': 'banners', 'items': [
  91. {'name': 'banner'},
  92. {'name': 'bannertype'},
  93. ]},
  94. ]
  95. JET_SIDE_MENU_ITEMS is a list of application or custom item dicts. Each item can have the following keys:
  96. * `app_label` - application name
  97. * `label` - application text label
  98. * `items` - list of children items
  99. * `url` - custom url (format is described below)
  100. * `url_blank` - open url in new table (boolean)
  101. * `permissions` - list of required permissions to display item
  102. Setting `items` and either `app_label` or `label` is required. Other keys are optional to override default behavior.
  103. Order of items is respected. Each menu item is also a dict with the following keys:
  104. * `name` - model name (can be either `MODEL_NAME` or `APP_LABEL.MODEL_NAME`)
  105. * `label` - item text label
  106. * `url` - custom url (format is described below)
  107. * `url_blank` - open url in new table (boolean)
  108. * `permissions` - list of required permissions to display item
  109. Setting either `name` or `label` is required. Other keys are optional to override default behavior.
  110. Order of items is respected.
  111. URLs can be either `string` or `dict`. Examples of possible values:
  112. * http://example.com/
  113. * {'type': 'app', 'app_label': 'pages'}
  114. * {'type': 'model', 'app_label': 'pages', 'model': 'page'}
  115. * {'type': 'reverse', 'name': 'pages:list', 'args': [1], 'kwargs': {'category': 2}}
  116. .. deprecated:: 1.0.6
  117. Old way of customizing menu items via `JET_SIDE_MENU_CUSTOM_APPS` setting is now deprecated in favor
  118. of new `JET_SIDE_MENU_ITEMS` setting.
  119. .. code:: python
  120. JET_SIDE_MENU_CUSTOM_APPS = [
  121. ('core', [ # Each list element is a tuple with application name (app_label) and list of models
  122. 'User',
  123. 'MenuItem',
  124. 'Block',
  125. ]),
  126. ('shops', [
  127. 'Shop',
  128. 'City',
  129. 'MetroStation',
  130. ]),
  131. ('feedback', [
  132. 'Feedback',
  133. ]),
  134. ]
  135. If have multiple admin sites and you want to specify different menu applications for each admin site, wrap menu lists
  136. in dictionary with admin site names as keys:
  137. .. code:: python
  138. JET_SIDE_MENU_ITEMS = {
  139. 'admin': [
  140. {'label': _('General'), 'app_label': 'core', 'items': [
  141. {'name': 'help.question'},
  142. {'name': 'pages.page'},
  143. {'name': 'city'},
  144. {'name': 'validationcode'},
  145. ]},
  146. ...
  147. ],
  148. 'custom_admin': [
  149. {'app_label': 'talks', 'items': [
  150. {'name': 'talk'},
  151. {'name': 'talkmessage'},
  152. ]},
  153. ...
  154. ]
  155. }
  156. .. note::
  157. You can use ``jet_side_menu_items_example`` management command to generate example ``JET_SIDE_MENU_ITEMS``
  158. setting which includes all your applications and models. You can use it this way:
  159. .. code:: python
  160. python manage.py jet_side_menu_items_example
  161. JET_CHANGE_FORM_SIBLING_LINKS
  162. -----------------------------
  163. .. image:: _static/change_form_sibling_links.png
  164. :width: 100%
  165. Adds buttons to change forms that allows you to navigate to previous/next object without returning back to change list.
  166. Can be disabled if hit performance.
  167. .. code:: python
  168. JET_CHANGE_FORM_SIBLING_LINKS = True
  169. Default is ``True``
  170. JET_INDEX_DASHBOARD
  171. -------------------
  172. Sets which dashboard class will be used for rendering admin index dashboard. Allows you to create
  173. your own dashboard with custom modules and pre-installed layout.
  174. .. code:: python
  175. JET_INDEX_DASHBOARD = 'jet.dashboard.dashboard.DefaultIndexDashboard'
  176. JET_APP_INDEX_DASHBOARD
  177. -----------------------
  178. Same as **JET_INDEX_DASHBOARD**, but for application pages
  179. .. code:: python
  180. JET_APP_INDEX_DASHBOARD = 'jet.dashboard.dashboard.DefaultAppIndexDashboard'