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

feat: provide action decorator to pass label, description and atts to the admin method #141

Merged
merged 4 commits into from
Nov 7, 2022

Conversation

Alexerson
Copy link
Contributor

@Alexerson Alexerson commented Oct 27, 2022

Add an @action decorator that behave's like Django's admin.action decorator1 to clean up customizing object actions.

closes #115

Also relates to #107

Footnotes

  1. https://docs.djangoproject.com/en/stable/ref/contrib/admin/actions/#django.contrib.admin.action

@Alexerson
Copy link
Contributor Author

I reused the same logic that is now in the django project. The test is a bit tautological, but at least it’s here. Let me know if you have any suggested changes.

@Alexerson Alexerson force-pushed the issue-115-add-label-decorator branch from fd80a02 to 425b4b6 Compare October 27, 2022 17:42
@Alexerson Alexerson force-pushed the issue-115-add-label-decorator branch from 425b4b6 to 27822e3 Compare October 27, 2022 17:44
@crccheck
Copy link
Owner

crccheck commented Nov 1, 2022

Thanks, if I need to do a major version release to drop old Django versions, I can do that. I'm just starting to get back into Python/Django so I can hopefully take a deeper look soon.

@Alexerson
Copy link
Contributor Author

I messed up with the test, sorry about that. Pushing the fix. I don’t think we need to drop anything for this to be merged, but let’s see once the tests run again.

@Alexerson Alexerson changed the title Add label/description decorator feat: provide action decorator to pass label, description and atts to the action method Nov 1, 2022
@Alexerson Alexerson changed the title feat: provide action decorator to pass label, description and atts to the action method feat: provide action decorator to pass label, description and atts to the admin method Nov 1, 2022
Copy link
Owner

@crccheck crccheck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I finally sat down and looked at the Django @action doc and everything looks good to me. I'm a little worried that action is too generic/overloaded but people can always rename it like

from django_object_actions import DjangoObjectActions, action as chocolate

I had one note but it's not a big deal. I'll merge tomorrow either way.

django_object_actions/utils.py Outdated Show resolved Hide resolved
Fix docstring method name

Co-authored-by: Chris Chang <[email protected]>
@Alexerson
Copy link
Contributor Author

That’s what happen when you copy code…
All good, thanks!

@crccheck crccheck merged commit 5638f99 into crccheck:master Nov 7, 2022
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 this pull request may close these issues.

2 participants