Opened 7 years ago

Closed 6 years ago

#11695 closed Uncategorized (duplicate)

Modified change list default sort

Reported by: Joshua Russo Owned by: nobody
Component: contrib.admin Version: master
Severity: Normal Keywords: change list default sort model-sort
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I've tweaked the change list sort handling so that by default it uses the full list of sort columns defined in the model. It sets all of the
headers as unselected and then behaves as it currently does if someone selects a header column to sort by. I've also modified the template to
add a Reset sort (or conditionally Reset sort and filter) button to bring everything back to the original state.

Attachments (5)

main.diff (1.7 KB) - added by Joshua Russo 7 years ago.
From \contrib\admin\views
admin_list.diff (592 bytes) - added by Joshua Russo 7 years ago.
From \contrib\admin\templatetags
change_list.diff (630 bytes) - added by Joshua Russo 7 years ago.
From \contrib\admin\templates\admin - Added the Reset button
change_list_sort.diff (8.4 KB) - added by Joshua Russo 7 years ago.
with testing and docs
change_list_sort.2.diff (8.4 KB) - added by Joshua Russo 7 years ago.
Trying upload without replace

Download all attachments as: .zip

Change History (14)

Changed 7 years ago by Joshua Russo

Attachment: main.diff added

From \contrib\admin\views

Changed 7 years ago by Joshua Russo

Attachment: admin_list.diff added

From \contrib\admin\templatetags

Changed 7 years ago by Joshua Russo

Attachment: change_list.diff added

From \contrib\admin\templates\admin - Added the Reset button

comment:1 Changed 7 years ago by Alex Gaynor

Please provide one diff from the root of the django tree.

comment:2 Changed 7 years ago by Adam Vandenberg

"if cl.order_field != None..." should be "if cl.order_field is not None..."

comment:3 Changed 7 years ago by dc

Component: Uncategorizeddjango.contrib.admin
Has patch: set
Needs documentation: set
Needs tests: set
Patch needs improvement: set

Better have two separate messages for i18n than creating message from chunks

<li><a href=".">
    {% if cl.has_filters or cl.date_hierarchy %}
        {% trans 'Reset sorting and filters' %}
    {% else %}
        {% trans 'Reset sorting' %}
    {% endif %}
</a></li>

comment:4 Changed 7 years ago by Joshua Russo

I've updated the code as suggested in the comments provided. (Diff done from root, IF statement fixed, and Trans split into 2 full phases)

Changed 7 years ago by Joshua Russo

Attachment: change_list_sort.diff added

with testing and docs

comment:5 Changed 7 years ago by Joshua Russo

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

Well I have all of the regression testing and docs added, but my upload doesn't seem to be working. It reports the correct file size but doesn't display the file when I click the file name after upload.

I also found and fixed a small bug in another of the admin_views tests.

Changed 7 years ago by Joshua Russo

Attachment: change_list_sort.2.diff added

Trying upload without replace

comment:6 Changed 7 years ago by Joshua Russo

milestone: 1.2

comment:7 Changed 7 years ago by Cliff Dyer

Triage Stage: UnreviewedDesign decision needed

comment:8 Changed 7 years ago by James Bennett

milestone: 1.2

1.2 is feature-frozen, moving this feature request off the milestone.

comment:9 Changed 6 years ago by Julien Phalip

Resolution: duplicate
Severity: Normal
Status: newclosed
Type: Uncategorized

Closing as a duplicate of #11868 which, although newer, suggests a better approach UI-wise.

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