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

'result' cannot be specified for MyTaskResult model form as it is a non-editable field. Check fields/fieldsets/exclude attributes of class MyTaskResultAdmin. #394

Open
chunkai-meng opened this issue Jun 3, 2023 · 2 comments

Comments

@chunkai-meng
Copy link

If I use a proxy model and register MyTaskResultAdmin inherited from TaskResultAdmin,
will show the error above

found in django_celery_results.admin.TaskResultAdmin.get_readonly_fields

    def get_readonly_fields(self, request, obj=None):
        if ALLOW_EDITS:
            return self.readonly_fields
        else:
            return list({
                field.name for field in self.opts.local_fields    # will return [] even readonly_fields is set, which leads to the error
                # field.name for field in self.model._meta.fields    # Change to this fix the problem, but I'm not sure if this is the correct way
            })
@auvipy
Copy link
Member

auvipy commented Jun 4, 2023

field.name for field in self.model._meta.fields should be the django API we should use

@pr0fg
Copy link

pr0fg commented Oct 14, 2023

Can confirm the following change works as expected:

field.name for field in self.model._meta.fields

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

No branches or pull requests

3 participants