Procházet zdrojové kódy

Update documentation

Denis K před 8 roky
rodič
revize
ea3755755d
1 změnil soubory, kde provedl 54 přidání a 28 odebrání
  1. 54 28
      docs/config_file.rst

+ 54 - 28
docs/config_file.rst

@@ -95,61 +95,87 @@ CUSTOM MENU
 -----------
 
 By default JET displays all applications and it models in the side menu in the alphabetical order.
-To display applications and models you want or to change their order you can use ``JET_SIDE_MENU_CUSTOM_APPS`` setting.
+To display applications and models you want or to change their order you can use ``JET_SIDE_MENU_ITEMS`` setting.
 
 .. code:: python
 
-    JET_SIDE_MENU_CUSTOM_APPS = [
-        ('core', [ # Each list element is a tuple with application name (app_label) and list of models
-            'User',
-            'MenuItem',
-            'Block',
-        ]),
-        ('shops', [
-            'Shop',
-            'City',
-            'MetroStation',
-        ]),
-        ('feedback', [
-            'Feedback',
-        ]),
+    JET_SIDE_MENU_ITEMS = [  # A list of application or custom dicts
+        {'label': _('General'), 'app_label': 'core', 'models': [
+            {'name': 'help.question'},
+            {'name': 'pages.page'},
+            {'name': 'city'},
+            {'name': 'validationcode'},
+        ]},
+        {'label': _('Users'), 'models': [
+            {'name': 'core.user'},
+            {'name': 'auth.group'},
+            {'name': 'core.userprofile'},
+        ]},
+        {'app_label': 'banners', 'models': [
+            {'name': 'banner'},
+            {'name': 'bannertype'},
+        ]},
+        {'app_label': 'talks', 'models': [
+            {'name': 'talk'},
+            {'name': 'talkmessage'},
+        ]},
     ]
 
-If want to show all application's models use ``__all__`` keyword.
+.. deprecated:: 1.0.6
 
-.. code:: python
+    Old way of customizing menu items via `JET_SIDE_MENU_CUSTOM_APPS` setting is now deprecated in favor
+    of new `JET_SIDE_MENU_ITEMS` setting.
 
-    JET_SIDE_MENU_CUSTOM_APPS = [
-        ('core', ['__all__']),
-        ...
-    ]
+    .. code:: python
+
+        JET_SIDE_MENU_CUSTOM_APPS = [
+            ('core', [ # Each list element is a tuple with application name (app_label) and list of models
+                'User',
+                'MenuItem',
+                'Block',
+            ]),
+            ('shops', [
+                'Shop',
+                'City',
+                'MetroStation',
+            ]),
+            ('feedback', [
+                'Feedback',
+            ]),
+        ]
 
 If have multiple admin sites and you want to specify different menu applications for each admin site, wrap menu lists
 in dictionary with admin site names as keys:
 
 .. code:: python
 
-    JET_SIDE_MENU_CUSTOM_APPS = {
+    JET_SIDE_MENU_ITEMS = {
         'admin': [
-            ('core', ['__all__']),
+            {'label': _('General'), 'app_label': 'core', 'models': [
+                {'name': 'help.question'},
+                {'name': 'pages.page'},
+                {'name': 'city'},
+                {'name': 'validationcode'},
+            ]},
             ...
         ],
         'custom_admin': [
-            ('custom_admin_app', [
-                'CustomAdminAppModel',
-            ]),
+            {'app_label': 'talks', 'models': [
+                {'name': 'talk'},
+                {'name': 'talkmessage'},
+            ]},
             ...
         ]
     }
 
 .. note::
 
-    You can use ``jet_custom_apps_example`` management command to generate example ``JET_SIDE_MENU_CUSTOM_APPS``
+    You can use ``jet_side_menu_items_example`` management command to generate example ``JET_SIDE_MENU_ITEMS``
     setting which includes all your applications and models. You can use it this way:
 
     .. code:: python
 
-        python manage.py jet_custom_apps_example
+        python manage.py jet_side_menu_items_example
 
 JET_CHANGE_FORM_SIBLING_LINKS
 -----------------------------