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

Add @admin.action and @admin.display #47

Closed
3 tasks done
adamchainz opened this issue Sep 17, 2021 · 3 comments · Fixed by #199
Closed
3 tasks done

Add @admin.action and @admin.display #47

adamchainz opened this issue Sep 17, 2021 · 3 comments · Fixed by #199

Comments

@adamchainz
Copy link
Owner

adamchainz commented Sep 17, 2021

Python Version

No response

Django Version

No response

Package Version

No response

Description

Find functions with appropriate attributes being set and rewrite them to use @admin.action or @admin.display respectively

https://docs.djangoproject.com/en/3.2/ref/contrib/admin/actions/#django.contrib.admin.action
https://docs.djangoproject.com/en/3.2/ref/contrib/admin/#django.contrib.admin.display

This is going to be a little tricky to do as multiple AST nodes will need inspecting and rewriting at once, if they all match.

We might need to visit class definitions and modules, and check all the function definitions within each + following assignments to figure out everything.

Steps:

@adamchainz
Copy link
Owner Author

@ngnpope check it out 😎

@ngnpope
Copy link

ngnpope commented Sep 14, 2022

Amazing! 🌟

Noticed one thing: This should also work for from django.contrib.gis import admin.

@adamchainz
Copy link
Owner Author

Ah, nicely spotted. I've also added that to the tasks for @admin.register in #190.

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 a pull request may close this issue.

2 participants