9👍
✅
currently django does not support collapsible inlines out-of-the-box. This ticket might give you some pointers.
Nevertheless you can easly achive this by adding some javascript to your template. There are numerous plugins out there that can help you achieve this. The way to add a js to a template is overriding a ModelAdmin form with a ModelForm and setting it’s Media class with the appropiate js script.
Hope this helps.
89👍
In Django 1.10+:
class MyModelInline(admin.TabularInline):
model = MyModel
classes = ['collapse']
- [Django]-Differences between STATICFILES_DIR, STATIC_ROOT and MEDIA_ROOT
- [Django]-Django migrate : doesn't create tables
- [Django]-Connect to a DB using psycopg2 without password
8👍
Check out this snippet, and you just need to include jQuery (already with Django).
- [Django]-Django query get last n records
- [Django]-Django contrib admin default admin and password
- [Django]-Django setting environment variables in unittest tests
Source:stackexchange.com