django-modeladmin-reorder
django-modeladmin-reorder copied to clipboard
Handle admin sidebar in Django 3.1
Starting from 3.1, Django has a sidebar in the admin. The sidebar looks very much like the apps and models list on admin dashboard. Perhaps django-modelsadmin-reorder should handle the sidebar as well, so that it lists the same models as on the dashboard.
I created a PR for that https://github.com/mishbahr/django-modeladmin-reorder/pull/49
You can install admin_reorder from my fork for now.
pip install git+git://github.com/bloodwithmilk25/django-modeladmin-reorder.git@master
I just upgraded to Django 3.1 and started using django-modeladmin-reorder and immediately hit this too. @bloodwithmilk25 , your PR looks good - hoping it will get merged 😄
The changes made to the middleware would break the packages compatibility to python 2 versions of django
Three words for Python 2: EOL 😁
while those three words are true, it doesn't mean there aren't system still running it :) a solution is available that both fixes the issue with django 3.1 while retaining backwards compatibility
Hi @mishbahr , Any chance to merge #49 and release it at PyPI?
while those three words are true, it doesn't mean there aren't system still running it :) a solution is available that both fixes the issue with django 3.1 while retaining backwards compatibility
I think you are right. PR #49 aims to solve the problem with the sidebar. Changes from string_types to str should not be a hidden target for this PR #49 ...
@mishbahr +1 on getting this merged and released.
I tested it on Django 3.1.5 and it works! could you merge and publish? please. Thank you =)
just added to project's urls.py
admin.autodiscover()
admin.site.enable_nav_sidebar = False
and this problem will be solved :)
I created a PR for that #49 You can install admin_reorder from my fork for now.
pip install git+git://github.com/bloodwithmilk25/django-modeladmin-reorder.git@master
Thanks! It worked quite well! I'm using jazzmin for the styling, it provides a dashboard and I don't know why when I navigate to the dashboard the sidebar stops being organized following the configuration. Any suggestion about how to work it out? Thank you!
I created a PR for that #49 You can install admin_reorder from my fork for now.
pip install git+git://github.com/bloodwithmilk25/django-modeladmin-reorder.git@master
Thank you, it worked for me :) Perfect
Hi @mishbahr ,
If you need help with maintaining that project, let us know. Maybe we should transform it to JazzBand organization.
I created a PR for that #49 You can install admin_reorder from my fork for now.
pip install git+git://github.com/bloodwithmilk25/django-modeladmin-reorder.git@master
It doesn't work for Django 3.2.2
I created a PR for that #49 You can install admin_reorder from my fork for now.
pip install git+git://github.com/bloodwithmilk25/django-modeladmin-reorder.git@masterIt doesn't work for Django 3.2.2
Are you using the master branch or that PR? I use commit SHA 6cc5060 which is from the PR, and it's been working well for me since I installed from that rather than the latest release. Currently on Django 3.2.5.
I created a PR for that #49 You can install admin_reorder from my fork for now.
pip install git+git://github.com/bloodwithmilk25/django-modeladmin-reorder.git@masterIt doesn't work for Django 3.2.2
Are you using the master branch or that PR? I use commit SHA 6cc5060 which is from the PR, and it's been working well for me since I installed from that rather than the latest release. Currently on Django 3.2.5.
I've just run: pip install git+git://github.com/bloodwithmilk25/django-modeladmin-reorder.git@master
and nothing happened in output. Is it related to the Django version because mine is 3.2.2

Hack middleware
class ModelAdminReorderWithNav(ModelAdminReorder):
def process_template_response(self, request, response):
if (
getattr(response, 'context_data', None)
and not response.context_data.get('app_list')
and (available_apps := response.context_data.get('available_apps'))
):
response.context_data['app_list'] = available_apps
response = super().process_template_response(request, response)
response.context_data['available_apps'] = response.context_data[
'app_list'
]
return response
return super().process_template_response(request, response)
Thx, @SergeyDubovitsky ! This works great. It can be used it like this:
- Use
from admin_reorder.middleware import ModelAdminReorderin the file - Put it e.g. in
myapp/middleware, and in settings.py replace the admin_reorder middleware withmyapp.middleware.ModelAdminReorderWithNavor similar
I created a PR for that #49 You can install admin_reorder from my fork for now.
pip install git+git://github.com/bloodwithmilk25/django-modeladmin-reorder.git@masterThanks! It worked quite well! I'm using jazzmin for the styling, it provides a dashboard and I don't know why when I navigate to the dashboard the sidebar stops being organized following the configuration. Any suggestion about how to work it out? Thank you!
im also having the same issue is there a solution to fix the side bar as well im using Django==4.2.1
@mishbahr please take a look at this. we really need to either support this project or transfer it to someone who'll be able to maintain it.
either
my issue was fixed Thanks
pip install git+git://github.com/bloodwithmilk25/django-modeladmin-reorder.git@master
I was desperately trying to make the nav bar work (the home page reordering was working but not the nav bar for some reason) and this solve the issue. I had to change git+git to git+https but worked like a charm - just plug and play. Hopefully this will be integrated in the lib, but in any case many thanks!