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

has_change_permission not working properly for NestedStackedPolymorphicInline #217

Open
9Y0 opened this issue Mar 23, 2022 · 1 comment
Open

Comments

@9Y0
Copy link

9Y0 commented Mar 23, 2022

I have a polymorphic model Question with a submodel OpenQuestion. I use the following InlineAdmin:

class QuestionInline(SortableHiddenMixin, NestedStackedPolymorphicInline):
    model = Question

    class OpenQuestionInline(SortableHiddenMixin, NestedStackedPolymorphicInline.Child):
        model = OpenQuestion
        fields = (("description", "weight"), "position")

    child_inlines = (OpenQuestionInline,)

    def has_change_permission(self, request, obj=None):
        return False

    def has_add_permission(self, request, obj=None):
        return False

    def has_delete_permission(self, request, obj=None):
        return False

However, I can still change the description and weight field of the open question.
afbeelding
I'm also able to reorder them. When I save the object, these changes are not saved, but I think I still shouldn't be allowed to change the values. I also tried adding the has_..._permission methods to the OpenQuestionInline, but it did not seem that they were called.

@DAWorm1
Copy link

DAWorm1 commented Jul 17, 2023

I also have the same issue. My configuration is exactly the same (minus the SortableMixin). Regardless, I can still edit fields even when explicitly returning False in has_change_permission.

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

2 participants