﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
32405	Inline admin - last related item also hidden when user has no add_permission	Pirmin Schneider	nobody	"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 %}
```

"	Bug	new	contrib.admin	3.1	Normal		inline admin		Unreviewed	0	0	0	0	0	0
