django-nested-inline
django-nested-inline copied to clipboard
Fix read-only change view
Fixes #109
@OskarPersson i'm testing it, and still having the same output. I will try to debug to check if "read_only" variable is True in wrap_nested_inline_formsets
EDIT: I set up a Breakpoint at line 100 of admin.py, and found out that wrap_nested_inline_formsets() is not beign called
Okay. Feel free to add a PR to the read-only-change-view
branch if you figure something out :)
I just had some time and took another look. Looks like the method that you've fixed is only called when a Nested Inline inside another Inline is added. After noting that, i did a test (adding a Nested Inline inside my inline).
As you can see in the result, your code worked (the nested-inline is read only), but the parent container still editable.
EDIT
Adding "has_change_permission" keyword argument to InlineAdminFormSet will make the Inline Formset ReadOnly as expected. Also i fixed and error in your last commit; Read only should be TRUE if has_change_permission is false.
I'm still having a problem, As you can see in the next picture, the + buttons are shown. Clicking them will pop new read-only empty entries.
I will try to keep digging the solution
EDIT @OskarPersson i tried to push my changes to this branch (also to a new one) and looks like i don't have permissions to do it. I get 403 Forbidden Error
@gascarcella You need to make a fork of this repository and push to a branch there. From there you can create a PR to merge your branch into read-only-change-view
. See here for more information: https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork