-
-
Notifications
You must be signed in to change notification settings - Fork 67
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.display
decorators in models file too
#389
Comments
Yeah good point, would be nice to fix that. |
I'm not quite sure how to gracefully handle adding the |
I have ideas but haven’t implemented anything. I gave up on adding imports in the timezone.utc fixer. Something like “add after the last import statement at the top of the file” could work. We’d probably want to check that there’s nothing called |
This seems manageable, finding the last import in the module is not too hard. Doing that we can also check for possible import with the same name
I feel like this cost a lot, we would have to check every import, every variable assignment, every function/class definition and if there is any wildcard import, this is unsafe (but I'd say we can ignore this case). I'm not sure what do do here |
I agree it would be a bit costly, but we’d only need to do it in the case where we’d like to add the import. Anyway, this particularly fixer feels somewhat niche, at least in my experience I haven’t seen admin methods on models. |
Description
I think the display fixer doesn't support this use case from the docs:
Would be nice to have it work in that case too:
The text was updated successfully, but these errors were encountered: