Not working in Inline
- Django better admin ArrayField version: Latest Version
- Django version: 2.2.10
- Python version: 3.7
- Operating System: Ubuntu
Description
I was using an array field on normal modal but when I have made a model as an inline then I was not able to get an array field.
I have attached my demo repo in Question Model I am not able to add options and answers https://github.com/nitishxp/abidibo
What I Did
Attached demo repo link. [https://github.com/nitishxp/abidibo](url)
I also need this feature) @gradam
Same problem. Button "Add another" is not working.
I was able to get this working in production by manually placing django_better_admin_arrayfield.min.js and django_better_admin_arrayfield.min.css in static/js and static/cssin my project, respectively.
EDIT: sorry, I see the issue is with respect to an inline admin view, not a regular one.
Still, I will leave this comment in case it helps others.
FWIW for anyone using a normal admin view (not inline), I added the field but forgot to do the following steps from the setup, and got a "Add another" button which didn't do anything when clicked.
from django_better_admin_arrayfield.admin.mixins import DynamicArrayMixin
In your admin class add DynamicArrayMixin: ...
class MyModelAdmin(admin.ModelAdmin, DynamicArrayMixin):
After doing this the button was able to add fields. I did not have to copy any js or css file manually, but I did have to run python manage.py collectstatic to get the css and js files into the right place.
@nitishxp Did you manage to find a solution?
I also need this
Adding DynamicArrayMixin to the Inline admin class worked for me.
class AtlasProfileInline(admin.StackedInline, DynamicArrayMixin):
model = Profile
can_delete = False
verbose_name_plural = 'profiles'
class UserAdmin(BaseUserAdmin):
inlines = (AtlasProfileInline,)

Also works in my case (Django 4.0, django-better-admin-arrayfield 1.4.2).
I did experience a similar issue because in my Inline class I was overwriting the Meta.js attribute, so the library js was not loading.