Code

Opened 5 years ago

Closed 4 years ago

#11796 closed (fixed)

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

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

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 5 years ago.
Change single line in auth models to order permissions by app, model, then permission

Download all attachments as: .zip

Change History (4)

Changed 5 years ago by russryba

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

comment:1 Changed 5 years ago by russryba

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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 Changed 4 years ago by jezdez

  • Owner changed from nobody to jezdez
  • Status changed from new to assigned
  • Triage Stage changed from Unreviewed to Accepted
  • Version changed from 1.0 to SVN

comment:3 Changed 4 years ago by jezdez

  • Resolution set to fixed
  • Status changed from assigned to closed

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.