-
Notifications
You must be signed in to change notification settings - Fork 221
fix: error when registering TaskResultAdmin on proxy model #489
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for handling it. is there any way to verify the change? tests, screenshots etc?
|
I have added tests. The results before and after the modification are as follows: Before the modification: After the modification:
|
|
please check the failing test |
098afd2 to
6628e76
Compare
|
I've tried to fix it. Please let me know if any improvements are needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes an error that occurs when registering TaskResultAdmin on a Django proxy model by changing the field reference from self.opts.local_fields to self.model._meta.fields.
- Updates the get_readonly_fields method in TaskResultAdmin to use the correct field reference for proxy models
- Adds comprehensive test coverage for both regular and proxy model scenarios
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| django_celery_results/admin.py | Fixed field reference in get_readonly_fields method to work with proxy models |
| t/unit/test_admin.py | Added test cases for TaskResultAdmin functionality with both regular and proxy models |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <[email protected]>
Closes #394
I have tested using
field.name for field in self.model._meta.fieldson both the original model and the proxy model, and it works as expected.