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
This snippet provides support to create a bit more advanced forms, eg group fields together vertically and horizontally. It's a bit similar to the options one has about displaying fields in the admin.
These functions use JQuery to dynamically add new entries for stacked or tabular inlines on a change form. To enable it, change the parent model to include this Javascript as well as JQuery. Here's an example:
class MeetingAdmin(admin.ModelAdmin):
inlines = [MeetingDonationInline, MeetingExtraInline]
class Media:
js = ["/media/jquery-1.3.2.min.js",
"/media/dynamic_inlines.js"]
- javascript
- admin
- jquery
- inline
- tabular
- stacked
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
6 snippets posted so far.