Closed variant77 closed 7 years ago
I am happy to see the interest in my Pull Request and the discussion here (https://github.com/burke-software/django-mass-edit/pull/64). I would like to address the points raised:
OH, I didn't realize, that there is already similar PR to my own. Good work @variant77, I think that your's approach clearly goes further and is more faultproof. I think, that using hash is necessary and using sessions is only design choice which I think is not bad.
Although, my PR contains tests of the object_ids handling through sessions, so I think you could incorporate into your PR.
And one other think - the dist/django-mass-edit-2.6.tar.gz
and dist/django_mass_edit-2.6-py2.7.egg
files in your PR are there probably by mistake.
I have got following error with your code on Python 3, Django 1.9:
Unicode-objects must be encoded before hashing
on line 69 in django-mass-edit/massadmin/massadmin.py
hash_id = "session-%s" % hashlib.md5(object_ids).hexdigest()
Yes. they were by mistake. My first time contributing on github and didn't realize subsequent commits are also added to the PR. I rebased to remove them.
Also updated the tests to support sessions and added a test to check with many objects. Will fix the Python 3 compatability soon.
@variant77, @bufke Is there anything preventing this PR from pulling?
As far as I'm concerned it's ready. I'm using my fork in production and everyone is happy with finally being able to work with large sets.
@variant77: I have made an standalone application from this code, so it could be used also for other purposes: https://github.com/PetrDlouhy/django-admin-large-initial-data
@bufke: How about merging this?
@bufke Any news about this?
As I read it, this change solves the multiple tabs issue discussed on #64 right? Has anyone tested this out? This pull request should be rebased, it appears to contain some unrelated commits that are already in master.
It remains a disadvantage that this change forces people to use sessions right? Is there any potential problem with this? Can django admin even be used without sessions? I could use token or basic auth with django admin I think, though I don't know if people really do this or not. This project has 65 stars so probably not a huge active user base. Still we'd want to note the potential breaking change.
If anyone else wants to join this project as a maintainer let me know too. Once we can review these considerations I think I can merge this.
Yes. This resolves the issue of multiple tabs as the session field is a hash of the object_ids.
According to the docs (Overview section 2) django.contrib.sessions
is a dependency for django admin so we're covered there.
We can make this behavior optional or configurable but I don't think there is any need for it. old-style urls still work if you have them bookmarked so there is no real breaking change.
Released as 3.0. Please try it out.
When many objects are selected for mass edit the URL string can get very long, especially if the model's primary key has many digits or id a uuid. At some point the URL becomes too long and this will result in a server error.
My solution checks if the object_ids string is over 500 characters (We might want to have that number configurable) and if it is so stores the comma separated string in the request session instead of passing it along.