Snippet List
A simple jQuery javascript that collapses all stacked inline rows for better handling of large inline fieldsets.
It also adds "Show"/"Hide"-buttons for showing/hiding each row, which could be customized and styled using css.
**Usage (see below for example):**
Include the javascript on your admin page, together with jQuery, and it'll automatically affect all stacked inlines.
**Works with**
Django 3.1.4
(Might work with other versions with or without adjustments, but not tested)
**Use example:**
*admin.py:*
class DateInline(admin.StackedInline):
model = Date
extra = 10
class EventAdmin(admin.ModelAdmin):
inlines = [DateInline]
class Media:
js = ['js/collapsed-stacked-inlines.js']
admin.site.register(Event, EventAdmin)
- javascript
- admin
- jquery
- inline
- collapse
- stacked
It's just an extension for the admin. Replace the collapse.js (collapse.min.js) and use it like this in the admin fieldset option: ´´**'classes': ['collapse', 'open']**´´.
Without the 'open'-class, it will work as usual.
*Needs possibly fixing for IE <= 8* because IE doesn't support the ´´:not´´ selector.
- fieldset
- collapse
- collapsed
- open
- show
A simple jQuery javascript that collapses all stacked inline rows for better handling of large inline fieldsets.
It also adds "Show"/"Hide"-buttons for showing/hiding each row, which could be customized and styled using css.
**Usage (see below for example):**
Include the javascript on your admin page, together with jQuery, and it'll automatically affect all stacked inlines.
**Developed for:**
* jQuery 1.3.2
* Django trunk (tested in Django v1.0.2)
* (Might work with other versions with or without adjustments, but not tested)
**Use example: **
*admin.py:*
class DateInline(admin.StackedInline):
model = Date
extra = 10
class EventAdmin(admin.ModelAdmin):
inlines = [DateInline]
class Media:
js = ['js/jquery-1.3.2.min.js', 'js/collapsed_stacked_inlines.js',]
admin.site.register(Event, EventAdmin)
- javascript
- admin
- jquery
- inline
- collapse
- stacked
4 snippets posted so far.