[Django] #32405: Inline admin - last related item also hidden when user has no add_permission

5 views
Skip to first unread message

Django

unread,
Feb 1, 2021, 10:20:16 AM2/1/21
to django-...@googlegroups.com
#32405: Inline admin - last related item also hidden when user has no
add_permission
-----------------------------------------+------------------------------
Reporter: pirm-in | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 3.1
Severity: Normal | Keywords: inline admin
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------------
Reproduce:
* Create a TabularInline admin
* add

{{{

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

Observed behavior:
The add-button disappears, and the last item of the related inline items
disappears.

Expected behavior:
Only the add-button disappears

For some reason the `empty-form` class is added multiple times. Once
(correctly) to the `add-row` and once to the last `form-row` (while the
`add-row` is in fact the last row of the table in the DOM)

This LOC in `django/contrib/admin/tabular.html` seems relevant, although i
cannot see the issue there

```
% if forloop.last and inline_admin_formset.has_add_permission %} empty-
form{% endif %}
```

--
Ticket URL: <https://code.djangoproject.com/ticket/32405>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 1, 2021, 10:28:50 AM2/1/21
to django-...@googlegroups.com
#32405: Inline admin - last related item also hidden when user has no
add_permission
----------------------------------+--------------------------------------
Reporter: Pirmin Schneider | Owner: nobody

Type: Bug | Status: new
Component: contrib.admin | Version: 3.1
Severity: Normal | Resolution:

Keywords: inline admin | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------
Description changed by Pirmin Schneider:

Old description:

> Reproduce:
> * Create a TabularInline admin
> * add
>
> {{{
>
> def has_add_permission(self, request, obj=None):
> return False
> }}}
>
> Observed behavior:
> The add-button disappears, and the last item of the related inline items
> disappears.
>
> Expected behavior:
> Only the add-button disappears
>
> For some reason the `empty-form` class is added multiple times. Once
> (correctly) to the `add-row` and once to the last `form-row` (while the
> `add-row` is in fact the last row of the table in the DOM)
>
> This LOC in `django/contrib/admin/tabular.html` seems relevant, although
> i cannot see the issue there
>
> ```
> % if forloop.last and inline_admin_formset.has_add_permission %} empty-
> form{% endif %}
> ```

New description:

Reproduce:
* Create a TabularInline admin
* add

{{{

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

Observed behavior:
The add-button disappears, and the last item of the related inline items
disappears.

Expected behavior:
Only the add-button disappears

For some reason the `empty-form` class is added multiple times. Once
(correctly) to the `add-row` and once to the last `form-row` (while the
`add-row` is in fact the last row of the table in the DOM)

This LOC in `django/contrib/admin/tabular.html` seems relevant, although i
cannot see the issue there

{{{
% if forloop.last and inline_admin_formset.has_add_permission %} empty-
form{% endif %}
}}}

--

--
Ticket URL: <https://code.djangoproject.com/ticket/32405#comment:1>

Django

unread,
Feb 1, 2021, 3:06:40 PM2/1/21
to django-...@googlegroups.com
#32405: Inline admin - last related item also hidden when user has no
add_permission
----------------------------------+--------------------------------------
Reporter: Pirmin Schneider | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 3.1
Severity: Normal | Resolution: needsinfo

Keywords: inline admin | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => needsinfo


Comment:

Thanks for this report, however I cannot reproduce the issue. Can you
provide a sample project?

--
Ticket URL: <https://code.djangoproject.com/ticket/32405#comment:2>

Reply all
Reply to author
Forward
0 new messages