Ticket #17905: admindocs_model_permissions.diff

File admindocs_model_permissions.diff, 666 bytes (added by chriscohoat, 13 years ago)

Check user permissions in the admindocs model index.

  • django/contrib/admindocs/views.py

    diff --git a/django/contrib/admindocs/views.py b/django/contrib/admindocs/views.py
    index 33d9a7d..9994df8 100644
    a b def view_detail(request, view):  
    169169def model_index(request):
    170170    if not utils.docutils_is_available:
    171171        return missing_docutils_page(request)
    172     m_list = [m._meta for m in models.get_models()]
     172    m_list = [m._meta for m in models.get_models() if request.user.has_module_perms(m._meta.app_label)]
    173173    return render_to_response('admin_doc/model_index.html', {
    174174        'root_path': urlresolvers.reverse('admin:index'),
    175175        'models': m_list
Back to Top