Opened 15 years ago

Closed 15 years ago

#11796 closed (fixed)

Change Permission ordering to sort by application, model, then permission

Reported by: russryba Owned by: Jannis Leidel
Component: contrib.auth Version: dev
Severity: Keywords: Permission ordering
Cc: russryba@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Using Django 1.0.2 final.

Problem:
Permissions are automatically sorted by application name, then by the permission, then by the model. This makes setting up permissions look like this:

  polls | choice | Can add choice
  polls | poll | Can add poll
  polls | choice | Can change choice
  polls | poll | Can change poll
  polls | choice | Can delete choice
  polls | poll | Can delete poll

Instead I would like it to be

  polls | choice | Can add choice
  polls | choice | Can change choice
  polls | choice | Can delete choice
  polls | poll | Can add poll
  polls | poll | Can change poll
  polls | poll | Can delete poll

I found this is how the system used to work according to tickets #7115 and #8246. I don't think 8246 is correct. This should be a one line change to django/contrib/auth/models.py as follows to sort by application, then model, then permission.

        # pre 7115 ordering = ('content_type', 'codename') 
 	# post 8246 ordering = ('content_type__app_label', 'codename') 
        ordering = ('content_type__app_label', 'content_type', 'codename')


Attachments (1)

django_1.0.2__contrib_auth_model.diff (775 bytes ) - added by russryba 15 years ago.
Change single line in auth models to order permissions by app, model, then permission

Download all attachments as: .zip

Change History (4)

by russryba, 15 years ago

Change single line in auth models to order permissions by app, model, then permission

comment:1 by russryba, 15 years ago

The diff file was generated using command line diff instead of svn diff. I just noticed it wasn't formatting correctly using the diff viewer and that is why. Sounds silly for a single line change.

comment:2 by Jannis Leidel, 15 years ago

Owner: changed from nobody to Jannis Leidel
Status: newassigned
Triage Stage: UnreviewedAccepted
Version: 1.0SVN

comment:3 by Jannis Leidel, 15 years ago

Resolution: fixed
Status: assignedclosed

(In [12219]) Fixed #11796 - Tweaked ordering of permissions a little more to be even nicer.

Note: See TracTickets for help on using tickets.
Back to Top