Hi Belen,
I have the task anchors page to the proper All Tasks page working.
The commit branch is: dreyna/task_anchor_5933
The implementation was tricky. Here are my notes, which I will add to bugzilla
to track for the future:
* Since the "#" anchor is never passed to the server, I updated the link to
also include the anchor in the normal part of the URL so that it could be
passed to the view class.
* I updated "urls.py" to catch that new URL, and the view class now gets this
new optional anchor value.
* The view class will immediately do a redirect since the mandatory
parameters will not be present. I allow this so that we can drop the URL
extension and not be caught in a locked loop. I instead move the anchor value
to a parameter ("anchor").
While using a parameter may appear to be much the same thing and using part of
the base URL, it is in practice very different. URLs are immutable, but
parameters can be made mutable (with a copy/replace on the GET array), and thus
I can escape that lock once I sort the pages.
* Once the queryset is set up and before the pagination, the code iterates
through the queryset until it finds its anchor value. It then computes the new
page, updates the page number, drops the anchor parameter, and does a redirect.
Everything is now back to normal workflow.
I did experiment with not doing the last redirect and avoiding the duplicate
query. The problem is that the resulting URL in the browser will always refer
to page 1 even though the proper page is displayed, and while this does not
affect the functionality I am concerned it will cause problems later. Also, for
some reason without the redirect by browser will not let go of the "#" anchor.
Again this does not affect the functionality but it looks wrong and could have
consequences later, especially since Javascript code would see this incorrect
URL and could break in odd ways.
- David
--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster