href missing in compact sidebar if user only has view permission
cdelacombaz opened this issue · 1 comments
cdelacombaz commented
Versions
Django==4.1.3
django-jet-reboot=1.3.3
Description
If a django project is set up with JET_SIDE_MENU_COMPACT = True
and a staff member has only a view access for a certain model, the href is missing from the sidebar item.
In jet/utils/get_app_list the url only gets added to the model, if a user has change or add permission:
https://github.com/assem-ch/django-jet-reboot/blob/master/jet/utils.py#L85
I'd be happy to contribute and write a PR for this. But can someone tell me if it's as easy as I think or what should be done?
Would modifying the existing code as following be ok?
if perms.get('view', False) or perms.get('change', False) :
try:
model_dict['admin_url'] = reverse('admin:%s_%s_changelist' % info, current_app=admin_site.name)
except NoReverseMatch:
pass
cdelacombaz commented
oh damn, didn't find an issue but just saw after submitting that a PR is already open! :)