- commit
- 05a5ff23092740435353cb1f262e113f94dc56e1
- parent
- 26170896a677f0258c27cff7b44621b0b970311d
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2020-08-13 07:43
include calendar in app list
Diffstat
| M | rebelstuff/admin.py | 17 | ++++++++++++++++- |
1 files changed, 16 insertions, 1 deletions
diff --git a/rebelstuff/admin.py b/rebelstuff/admin.py
@@ -7,13 +7,28 @@ from django.utils.translation import gettext_lazy as _ 7 7 from . import models 8 8 from .views import ContractView 9 9 -1 10 CALENDAR_ITEM = { -1 11 'name': _('Calendar'), -1 12 'admin_url': '/calendar/', -1 13 'view_only': True, -1 14 } -1 15 10 16 11 17 class Site(admin.AdminSite): 12 18 site_header = 'RebelStuff' 13 19 site_title = 'RebelStuff'14 -1 site_url = '/calendar/'-1 20 site_url = None 15 21 index_title = _('Home') 16 22 -1 23 def _build_app_dict(self, request, label=None): -1 24 app_dict = super()._build_app_dict(request, label=label) -1 25 if request.user.has_perm('rebelstuff.view_booking'): -1 26 if 'rebelstuff' in app_dict: -1 27 app_dict['rebelstuff']['models'].append(CALENDAR_ITEM) -1 28 elif app_dict.get('app_label') == 'rebelstuff': -1 29 app_dict['models'].append(CALENDAR_ITEM) -1 30 return app_dict -1 31 17 32 18 33 class StuffAdmin(admin.ModelAdmin): 19 34 list_display = ['name', 'amount', 'available']