-
Notifications
You must be signed in to change notification settings - Fork 599
feat: add a sort filter for django for the lisdexylic of us (like me) #9677
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9677 +/- ##
==========================================
- Coverage 88.87% 88.86% -0.01%
==========================================
Files 319 319
Lines 41925 41928 +3
==========================================
+ Hits 37260 37261 +1
- Misses 4665 4667 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Right you are. Doh! Co-authored-by: Jennifer Richards <[email protected]>
@jennifer-richards I also don't know if this is the only place that a change needs to be made. |
There's more that would need to happen I think. The comparisons need to operate on rfc numbers. The sort is probably more easily done in the view rather than the template, and the work needs to affect both this view and the /doc/html view. |
@rjsparks there is fill_in_document_table_attributes in doc/utils_search.py. That seems to be where these values get filled in. One could add a second loop after this code:
Is that what you are referring to? |
Yes, and it's only a couple of sort statements that need to be added, and I think we'll need to pass an explicit definition of the sort key to the sorting function (to pull the rfc number out of the doc object as an integer). I'd also look for a similar place that gathers updates and obsoletes. |
If that doc list is strings, of "rfc1234", then a lexical sort should be fine, right? It seems to me like we are looking at something like this:
This presumes that doc_dict doesn't include all RFCs/drafts. Otherwise we have to go through the same game as above. |
The rfc numbers don't have leading zeros, so lexical sort won't match numerical sort. |
Right - Think of rfc20. But I may have reacted to where you were pointing in the code incorrectly - are you trying to solve the sorting on pages like https://datatracker.ietf.org/doc/rfc3261/? If so, then the code you're looking at in utils_search isn't relevant. That's used for pages like https://datatracker.ietf.org/group/sip/documents/ (which looks sorted to me already). If it's the first kind of link you're after, you need to be looking at this view: datatracker/ietf/doc/views_doc.py Line 197 in 24101bb
datatracker/ietf/doc/views_doc.py Lines 338 to 372 in 24101bb
|
Eliot - do you want to continue pushing on this to drive learning, or do you want us to pick it up? |
Hi Robert- I won't have time to dink this until the IETF. If you want to move faster, please feel free to do so. |
WARNING
Eliot is playing with code he may not understand.
Not quite sure how to test this in a sandbox, but happy to learn.
Intent
The intent is to sort he list of RFCs that appear in the "obsoleted by" and "updated by" lists. This makes it easier to spot RFCs in long lists, like that of RFC 2026, for instance.
Method
Register a new function "sort" and then invoke it in the template.