authbox-menu 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. authbox-menu-1.0.0/LICENSE +29 -0
  2. authbox-menu-1.0.0/MANIFEST.in +5 -0
  3. authbox-menu-1.0.0/PKG-INFO +130 -0
  4. authbox-menu-1.0.0/README.md +115 -0
  5. authbox-menu-1.0.0/authbox_menu.egg-info/PKG-INFO +130 -0
  6. authbox-menu-1.0.0/authbox_menu.egg-info/SOURCES.txt +43 -0
  7. authbox-menu-1.0.0/authbox_menu.egg-info/dependency_links.txt +1 -0
  8. authbox-menu-1.0.0/authbox_menu.egg-info/requires.txt +2 -0
  9. authbox-menu-1.0.0/authbox_menu.egg-info/top_level.txt +2 -0
  10. authbox-menu-1.0.0/menu/__init__.py +0 -0
  11. authbox-menu-1.0.0/menu/_version.py +12 -0
  12. authbox-menu-1.0.0/menu/admin.py +30 -0
  13. authbox-menu-1.0.0/menu/apps.py +6 -0
  14. authbox-menu-1.0.0/menu/auto_insert_group.py +40 -0
  15. authbox-menu-1.0.0/menu/menus.py +418 -0
  16. authbox-menu-1.0.0/menu/migrations/0001_initial.py +109 -0
  17. authbox-menu-1.0.0/menu/migrations/0002_menugroup_kind.py +18 -0
  18. authbox-menu-1.0.0/menu/migrations/0003_menu_is_new_alter_menu_link.py +23 -0
  19. authbox-menu-1.0.0/menu/migrations/0004_alter_menu_menu_group.py +18 -0
  20. authbox-menu-1.0.0/menu/migrations/0005_remove_menugroup_site_menugroup_group_and_more.py +30 -0
  21. authbox-menu-1.0.0/menu/migrations/0006_alter_menugrouptranslation_unique_together_and_more.py +40 -0
  22. authbox-menu-1.0.0/menu/migrations/0007_auto_20230130_1141.py +21 -0
  23. authbox-menu-1.0.0/menu/migrations/0008_menu_exclude_menu.py +18 -0
  24. authbox-menu-1.0.0/menu/migrations/0009_menu_is_initial_data.py +18 -0
  25. authbox-menu-1.0.0/menu/migrations/__init__.py +0 -0
  26. authbox-menu-1.0.0/menu/models.py +335 -0
  27. authbox-menu-1.0.0/menu/templates/admin/parler/change_form.html +6 -0
  28. authbox-menu-1.0.0/menu/templates/admin/parler/deletion_not_allowed.html +6 -0
  29. authbox-menu-1.0.0/menu/templates/admin/parler/edit_inline/stacked_tabs.html +2 -0
  30. authbox-menu-1.0.0/menu/templates/admin/parler/edit_inline/tabular_tabs.html +2 -0
  31. authbox-menu-1.0.0/menu/templates/admin/parler/language_tabs.html +20 -0
  32. authbox-menu-1.0.0/menu/templates/index.html +53 -0
  33. authbox-menu-1.0.0/menu/templates/test-menu.html +158 -0
  34. authbox-menu-1.0.0/menu/templatetags/__init__.py +0 -0
  35. authbox-menu-1.0.0/menu/templatetags/menu_tags.py +213 -0
  36. authbox-menu-1.0.0/menu/tests.py +3 -0
  37. authbox-menu-1.0.0/menu/urls.py +9 -0
  38. authbox-menu-1.0.0/menu/views.py +30 -0
  39. authbox-menu-1.0.0/proj_menu/__init__.py +0 -0
  40. authbox-menu-1.0.0/proj_menu/asgi.py +16 -0
  41. authbox-menu-1.0.0/proj_menu/settings.py +174 -0
  42. authbox-menu-1.0.0/proj_menu/urls.py +27 -0
  43. authbox-menu-1.0.0/proj_menu/wsgi.py +16 -0
  44. authbox-menu-1.0.0/setup.cfg +4 -0
  45. authbox-menu-1.0.0/setup.py +106 -0
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2022, Iwan Setiawan (ione03)
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,5 @@
1
+ include LICENSE
2
+ include README.md
3
+
4
+ recursive-include menu/templates *
5
+ recursive-include menu/templatetags *
@@ -0,0 +1,130 @@
1
+ Metadata-Version: 2.1
2
+ Name: authbox-menu
3
+ Version: 1.0.0
4
+ Summary: Auto create menu base on table values
5
+ Home-page: https://github.com/PROJECT-OUTBOX/authbox_menu.git
6
+ Author-email: suratiwan03@gmail.com
7
+ Keywords: menu,model base,environment,django
8
+ Classifier: License :: OSI Approved :: BSD License
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Programming Language :: Python :: 3 :: Only
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: django-parler
14
+ Requires-Dist: authbox-setup-version
15
+
16
+ # DJANGO OUTBOX MENU
17
+
18
+ Menu is almost use in every web project.
19
+
20
+ With this library you can create menu for backend and frontend project without headache.
21
+ All you need to do is:
22
+
23
+
24
+ ## In your django Environment
25
+
26
+ ### Install package to your environment
27
+ > pip install django-outbox-menu
28
+
29
+ ### Add to INSTALLED_APPS
30
+ INSTALLED_APPS = [
31
+ 'django.contrib.sites',
32
+ 'menu',
33
+ ]
34
+
35
+ ### Add SITE_ID in user settings.py
36
+ SITE_ID = 1
37
+
38
+ ### Include library URLS
39
+ urlpatterns += [
40
+ path('', include('menu.urls')),
41
+ ]
42
+
43
+ ### Install requirements
44
+ Activate your environment using
45
+ > mkvirtualenv env_menu
46
+
47
+ ### Migrate to create table to your database
48
+ > python manage.py migrate
49
+
50
+ ## In your django Templates
51
+
52
+ ### Load menu tags
53
+ > {% load menu_tags %}
54
+
55
+ ### Generate menu
56
+ > {% menu_create FRONTEND 0 as my_menu %}
57
+ syntax :
58
+ > menu_create <menu_kind> <menu_group> as var_name
59
+ > menu_kind : FRONTEND or BACKEND
60
+ > menu_group :
61
+ 0 : None (use only for FRONTEND)
62
+ 1 : Owner
63
+ 2 : Manager
64
+ 3 : Operator
65
+ 4 : Cashier
66
+ etc ... (Update in admin page section [Menu Groups])
67
+
68
+ > {% for n in my_menu %}
69
+ n have all menu fields such as :
70
+ n.id
71
+ n.parent_id
72
+ n.name
73
+ n.link
74
+ n.icon
75
+ n.is_external
76
+ n.level
77
+ n.haveChild
78
+ n.haveChildEndTag
79
+ You can use it inside for loop
80
+
81
+ > example in you templates
82
+ <ul class="main-menu">
83
+ {% menu_create FRONTEND 0 as my_menu %}
84
+ {% for n in my_menu %}
85
+
86
+ {% if forloop.first %}
87
+ <li class="main-menu-active">
88
+ {% else %}
89
+ <li>
90
+ {% endif %}
91
+
92
+ {% if n.haveChild %}
93
+ <a href="#"> {{n.name}}
94
+ {% if n.parent_id %}
95
+ <i class="zmdi zmdi-chevron-right text-to-right"></i>
96
+ {% endif %}
97
+ </a>
98
+ <ul class="sub-menu">
99
+ {% else %}
100
+ <a class="clear-content-right" href="#"> {{n.name}} </a>
101
+ {% endif %}
102
+
103
+
104
+ {% for i in n.haveChildEndTag %}
105
+ <!-- Count = {{forloop.counter}} -->
106
+ {% if forloop.last %}
107
+ {% if n.parent_id %}
108
+ </li></ul>
109
+ {% if not n.haveChild %}
110
+ </li> <!-- li -->
111
+ {% endif %}
112
+ {% else %}
113
+ </li> <!-- Root -->
114
+ {% endif %}
115
+
116
+ {% else %}
117
+ </li></ul>
118
+ {% endif %}
119
+
120
+ {% endfor %}
121
+
122
+ {% endfor %}
123
+ </ul>
124
+
125
+ ### Run project
126
+ > python manage.py runserver
127
+ on you browser :
128
+ 127.0.0.1:8000
129
+ 127.0.0.1:8000/menu
130
+ 127.0.0.1:8000/admin
@@ -0,0 +1,115 @@
1
+ # DJANGO OUTBOX MENU
2
+
3
+ Menu is almost use in every web project.
4
+
5
+ With this library you can create menu for backend and frontend project without headache.
6
+ All you need to do is:
7
+
8
+
9
+ ## In your django Environment
10
+
11
+ ### Install package to your environment
12
+ > pip install django-outbox-menu
13
+
14
+ ### Add to INSTALLED_APPS
15
+ INSTALLED_APPS = [
16
+ 'django.contrib.sites',
17
+ 'menu',
18
+ ]
19
+
20
+ ### Add SITE_ID in user settings.py
21
+ SITE_ID = 1
22
+
23
+ ### Include library URLS
24
+ urlpatterns += [
25
+ path('', include('menu.urls')),
26
+ ]
27
+
28
+ ### Install requirements
29
+ Activate your environment using
30
+ > mkvirtualenv env_menu
31
+
32
+ ### Migrate to create table to your database
33
+ > python manage.py migrate
34
+
35
+ ## In your django Templates
36
+
37
+ ### Load menu tags
38
+ > {% load menu_tags %}
39
+
40
+ ### Generate menu
41
+ > {% menu_create FRONTEND 0 as my_menu %}
42
+ syntax :
43
+ > menu_create <menu_kind> <menu_group> as var_name
44
+ > menu_kind : FRONTEND or BACKEND
45
+ > menu_group :
46
+ 0 : None (use only for FRONTEND)
47
+ 1 : Owner
48
+ 2 : Manager
49
+ 3 : Operator
50
+ 4 : Cashier
51
+ etc ... (Update in admin page section [Menu Groups])
52
+
53
+ > {% for n in my_menu %}
54
+ n have all menu fields such as :
55
+ n.id
56
+ n.parent_id
57
+ n.name
58
+ n.link
59
+ n.icon
60
+ n.is_external
61
+ n.level
62
+ n.haveChild
63
+ n.haveChildEndTag
64
+ You can use it inside for loop
65
+
66
+ > example in you templates
67
+ <ul class="main-menu">
68
+ {% menu_create FRONTEND 0 as my_menu %}
69
+ {% for n in my_menu %}
70
+
71
+ {% if forloop.first %}
72
+ <li class="main-menu-active">
73
+ {% else %}
74
+ <li>
75
+ {% endif %}
76
+
77
+ {% if n.haveChild %}
78
+ <a href="#"> {{n.name}}
79
+ {% if n.parent_id %}
80
+ <i class="zmdi zmdi-chevron-right text-to-right"></i>
81
+ {% endif %}
82
+ </a>
83
+ <ul class="sub-menu">
84
+ {% else %}
85
+ <a class="clear-content-right" href="#"> {{n.name}} </a>
86
+ {% endif %}
87
+
88
+
89
+ {% for i in n.haveChildEndTag %}
90
+ <!-- Count = {{forloop.counter}} -->
91
+ {% if forloop.last %}
92
+ {% if n.parent_id %}
93
+ </li></ul>
94
+ {% if not n.haveChild %}
95
+ </li> <!-- li -->
96
+ {% endif %}
97
+ {% else %}
98
+ </li> <!-- Root -->
99
+ {% endif %}
100
+
101
+ {% else %}
102
+ </li></ul>
103
+ {% endif %}
104
+
105
+ {% endfor %}
106
+
107
+ {% endfor %}
108
+ </ul>
109
+
110
+ ### Run project
111
+ > python manage.py runserver
112
+ on you browser :
113
+ 127.0.0.1:8000
114
+ 127.0.0.1:8000/menu
115
+ 127.0.0.1:8000/admin
@@ -0,0 +1,130 @@
1
+ Metadata-Version: 2.1
2
+ Name: authbox-menu
3
+ Version: 1.0.0
4
+ Summary: Auto create menu base on table values
5
+ Home-page: https://github.com/PROJECT-OUTBOX/authbox_menu.git
6
+ Author-email: suratiwan03@gmail.com
7
+ Keywords: menu,model base,environment,django
8
+ Classifier: License :: OSI Approved :: BSD License
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Programming Language :: Python :: 3 :: Only
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: django-parler
14
+ Requires-Dist: authbox-setup-version
15
+
16
+ # DJANGO OUTBOX MENU
17
+
18
+ Menu is almost use in every web project.
19
+
20
+ With this library you can create menu for backend and frontend project without headache.
21
+ All you need to do is:
22
+
23
+
24
+ ## In your django Environment
25
+
26
+ ### Install package to your environment
27
+ > pip install django-outbox-menu
28
+
29
+ ### Add to INSTALLED_APPS
30
+ INSTALLED_APPS = [
31
+ 'django.contrib.sites',
32
+ 'menu',
33
+ ]
34
+
35
+ ### Add SITE_ID in user settings.py
36
+ SITE_ID = 1
37
+
38
+ ### Include library URLS
39
+ urlpatterns += [
40
+ path('', include('menu.urls')),
41
+ ]
42
+
43
+ ### Install requirements
44
+ Activate your environment using
45
+ > mkvirtualenv env_menu
46
+
47
+ ### Migrate to create table to your database
48
+ > python manage.py migrate
49
+
50
+ ## In your django Templates
51
+
52
+ ### Load menu tags
53
+ > {% load menu_tags %}
54
+
55
+ ### Generate menu
56
+ > {% menu_create FRONTEND 0 as my_menu %}
57
+ syntax :
58
+ > menu_create <menu_kind> <menu_group> as var_name
59
+ > menu_kind : FRONTEND or BACKEND
60
+ > menu_group :
61
+ 0 : None (use only for FRONTEND)
62
+ 1 : Owner
63
+ 2 : Manager
64
+ 3 : Operator
65
+ 4 : Cashier
66
+ etc ... (Update in admin page section [Menu Groups])
67
+
68
+ > {% for n in my_menu %}
69
+ n have all menu fields such as :
70
+ n.id
71
+ n.parent_id
72
+ n.name
73
+ n.link
74
+ n.icon
75
+ n.is_external
76
+ n.level
77
+ n.haveChild
78
+ n.haveChildEndTag
79
+ You can use it inside for loop
80
+
81
+ > example in you templates
82
+ <ul class="main-menu">
83
+ {% menu_create FRONTEND 0 as my_menu %}
84
+ {% for n in my_menu %}
85
+
86
+ {% if forloop.first %}
87
+ <li class="main-menu-active">
88
+ {% else %}
89
+ <li>
90
+ {% endif %}
91
+
92
+ {% if n.haveChild %}
93
+ <a href="#"> {{n.name}}
94
+ {% if n.parent_id %}
95
+ <i class="zmdi zmdi-chevron-right text-to-right"></i>
96
+ {% endif %}
97
+ </a>
98
+ <ul class="sub-menu">
99
+ {% else %}
100
+ <a class="clear-content-right" href="#"> {{n.name}} </a>
101
+ {% endif %}
102
+
103
+
104
+ {% for i in n.haveChildEndTag %}
105
+ <!-- Count = {{forloop.counter}} -->
106
+ {% if forloop.last %}
107
+ {% if n.parent_id %}
108
+ </li></ul>
109
+ {% if not n.haveChild %}
110
+ </li> <!-- li -->
111
+ {% endif %}
112
+ {% else %}
113
+ </li> <!-- Root -->
114
+ {% endif %}
115
+
116
+ {% else %}
117
+ </li></ul>
118
+ {% endif %}
119
+
120
+ {% endfor %}
121
+
122
+ {% endfor %}
123
+ </ul>
124
+
125
+ ### Run project
126
+ > python manage.py runserver
127
+ on you browser :
128
+ 127.0.0.1:8000
129
+ 127.0.0.1:8000/menu
130
+ 127.0.0.1:8000/admin
@@ -0,0 +1,43 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ README.md
4
+ setup.py
5
+ authbox_menu.egg-info/PKG-INFO
6
+ authbox_menu.egg-info/SOURCES.txt
7
+ authbox_menu.egg-info/dependency_links.txt
8
+ authbox_menu.egg-info/requires.txt
9
+ authbox_menu.egg-info/top_level.txt
10
+ menu/__init__.py
11
+ menu/_version.py
12
+ menu/admin.py
13
+ menu/apps.py
14
+ menu/auto_insert_group.py
15
+ menu/menus.py
16
+ menu/models.py
17
+ menu/tests.py
18
+ menu/urls.py
19
+ menu/views.py
20
+ menu/migrations/0001_initial.py
21
+ menu/migrations/0002_menugroup_kind.py
22
+ menu/migrations/0003_menu_is_new_alter_menu_link.py
23
+ menu/migrations/0004_alter_menu_menu_group.py
24
+ menu/migrations/0005_remove_menugroup_site_menugroup_group_and_more.py
25
+ menu/migrations/0006_alter_menugrouptranslation_unique_together_and_more.py
26
+ menu/migrations/0007_auto_20230130_1141.py
27
+ menu/migrations/0008_menu_exclude_menu.py
28
+ menu/migrations/0009_menu_is_initial_data.py
29
+ menu/migrations/__init__.py
30
+ menu/templates/index.html
31
+ menu/templates/test-menu.html
32
+ menu/templates/admin/parler/change_form.html
33
+ menu/templates/admin/parler/deletion_not_allowed.html
34
+ menu/templates/admin/parler/language_tabs.html
35
+ menu/templates/admin/parler/edit_inline/stacked_tabs.html
36
+ menu/templates/admin/parler/edit_inline/tabular_tabs.html
37
+ menu/templatetags/__init__.py
38
+ menu/templatetags/menu_tags.py
39
+ proj_menu/__init__.py
40
+ proj_menu/asgi.py
41
+ proj_menu/settings.py
42
+ proj_menu/urls.py
43
+ proj_menu/wsgi.py
@@ -0,0 +1,2 @@
1
+ django-parler
2
+ authbox-setup-version
@@ -0,0 +1,2 @@
1
+ menu
2
+ proj_menu
File without changes
@@ -0,0 +1,12 @@
1
+ """
2
+ Provides menu version information.
3
+ """
4
+
5
+ # This file is auto-generated! Do not edit!
6
+ # Use `python -m incremental.update menu` to change this file.
7
+
8
+ from incremental import Version
9
+
10
+ __version__ = Version("menu", 1, 0, 0)
11
+ __all__ = ["__version__"]
12
+
@@ -0,0 +1,30 @@
1
+ from django.contrib import admin
2
+ from parler.admin import TranslatableAdmin
3
+
4
+ from .models import Menu, MenuGroup # , MenuCustom
5
+
6
+ class MenuAdmin(TranslatableAdmin): # admin.ModelAdmin
7
+ #list_filter = ('name',)
8
+ list_display = ['name', 'parent', 'link', 'order_menu', 'kind', 'exclude_menu', 'is_initial_data', 'updated_at']
9
+ search_fields = ('name', 'parent')
10
+ ordering = ('-updated_at',)
11
+ # .order_by('parent_id','order_menu')
12
+
13
+ admin.site.register(Menu, MenuAdmin)
14
+
15
+ class MenuGroupAdmin(admin.ModelAdmin):
16
+ list_filter = ('kind',)
17
+ list_display = ['group', 'site_domain', 'level', 'kind', 'updated_at']
18
+ search_fields = ('group',)
19
+ ordering = ('-level',)
20
+
21
+ admin.site.register(MenuGroup, MenuGroupAdmin)
22
+
23
+ # tidak di update model yg ini
24
+ # class MenuCustomAdmin(admin.ModelAdmin):
25
+ # list_filter = ('menu',)
26
+ # list_display = ['menu', 'menu_group', 'updated_at']
27
+ # search_fields = ('menu',)
28
+ # ordering = ('-updated_at',)
29
+
30
+ # admin.site.register(MenuCustom, MenuCustomAdmin)
@@ -0,0 +1,6 @@
1
+ from django.apps import AppConfig
2
+
3
+
4
+ class MenuConfig(AppConfig):
5
+ default_auto_field = 'django.db.models.BigAutoField'
6
+ name = 'menu'
@@ -0,0 +1,40 @@
1
+ from .models import MenuGroup
2
+ from django.contrib.auth.models import Group
3
+
4
+ def create_groups(apps, schema_monitor):
5
+ '''
6
+ # auth_group = apps.get_model('django.contrib.auth', 'Group')
7
+ '''
8
+
9
+ # For backend
10
+ # -----------
11
+ mlist = [
12
+ 'Super Admin', # lvl 9
13
+ 'Developer', # lvl 8
14
+ 'Admin', # lvl 7
15
+ 'Owner', # lvl 6
16
+ 'Manager', # lvl 5
17
+ 'Operator' # lvl 4
18
+ ]
19
+
20
+ mlevel = 9
21
+ for i in mlist:
22
+ group, created = Group.objects.get_or_create(name=i)
23
+ if created:
24
+ MenuGroup.objects.create(group=group, kind=2, level=mlevel)
25
+ mlevel -= 1
26
+
27
+ # for frontend
28
+ # ------------
29
+ mlevel = 0
30
+ mlist = [
31
+ 'Anonymous', # lvl 0
32
+ ]
33
+ for i in mlist:
34
+ group, created = Group.objects.get_or_create(name=i)
35
+ if created:
36
+ MenuGroup.objects.create(group=group, kind=1, level=mlevel)
37
+ mlevel -= 1
38
+
39
+ # end (run on migrate)
40
+