Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set default order of PublishedProject to (title, version_order) and ActiveProject to (title, creation_datetime). Fixes #2132 #2133

Merged
merged 2 commits into from
Nov 20, 2023

Conversation

tompollard
Copy link
Member

@tompollard tompollard commented Nov 16, 2023

As discussed in #2132, there is no default ordering for Published Projects. This means that tools that render lists of projects are messy. It is often difficult to find the project of interest because there is no clear order. One example is the "Select parent project" selection tool that appears during project submission.

This pull request sets the default ordering for Published Projects and Active Projects to ('title', 'version'). I'd initially thought that we could set the ordering in the MetaData class, but it turns out that the Meta element of Django models isn't inherited.

@bemoody
Copy link
Collaborator

bemoody commented Nov 20, 2023

Don't sort by version, sort by version_order. 2.0 comes before 10.0.

That aside, it looks like this should address the unpredictability discussed in #2132.

However, this seemingly doesn't address all uses of unordered PublishedProject query sets (test_urls still generates one warning, I don't know from where.)

I also notice that there are two "project-autocomplete" views (one in project, one in console) that are exact duplicates of each other. It looks like the one in console is not being used and should be removed.

@tompollard
Copy link
Member Author

Don't sort by version, sort by version_order. 2.0 comes before 10.0.

I updated PublishedProject to use version_order. Looks like version_order doesn't exist for ActiveProject.

I also notice that there are two "project-autocomplete" views (one in project, one in console) that are exact duplicates of each other. It looks like the one in console is not being used and should be removed.

I can fix this, but it seems only loosely related to this change. Shall I put in a separate PR?

@bemoody
Copy link
Collaborator

bemoody commented Nov 20, 2023

Looks like version_order doesn't exist for ActiveProject.

Hmm, yeah, for active projects it's a different situation. I'm ambivalent about putting default orders on things, what makes sense in one case isn't necessarily desirable elsewhere. If you want a default order on active projects, then shouldn't it be submission date or creation date or something?

Shall I put in a separate PR?

Sure, please do.

@tompollard
Copy link
Member Author

tompollard commented Nov 20, 2023

If you want a default order on active projects, then shouldn't it be submission date or creation date or something?

I think having some default sort order is helpful (e.g. I fairly regularly find myself searching for active projects in the Django console, usually on my dev server). I've switched to creation_datetime as suggested.

@tompollard tompollard changed the title Set default order of PublishedProject and ActiveProject to (title, version). Fixes #2132 Set default order of PublishedProject to (title, version_order) and ActiveProject to (title, creation_datetime). Fixes #2132 Nov 20, 2023
@bemoody
Copy link
Collaborator

bemoody commented Nov 20, 2023

Thanks, looks good.

@bemoody bemoody merged commit cbc9182 into dev Nov 20, 2023
11 checks passed
@bemoody bemoody deleted the tp/default_project_order branch November 20, 2023 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants