{{{
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.
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>
* 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>