In my django application, I am using an admin interface to see all the products and each product can have several images. I have stacked the images into the Product Page using the below code
class ProductImage_Inline(admin.StackedInline):
model = ProductImage
extra = 3
formfield_overrides = {
ImageWithThumbnailField : {'widget' : AdminImageWithThumbnailWidget},
By default, in the Product Admin page I can't see all the images because all the entires in the StackedInline are collapsed by default. I have to manually click on each of them to expand so as to see the image.
How can I expand all the entries in a StackedInline by default?
P.S : I am using Grappelli theme and suspect that it is collapsing them by default
I realize that this is a bit late, but, as of Grappelli 2.3.7, you can now easily do what your trying to do with the "inline_classes" attribute of your Inline Class:
class MyInline(StackedInline):
model = MyModel
classes = ('collapse open',)
inline_classes = ('collapse open',)
This didn't seem to work in 2.3.5 (I had to upgrade to 2.3.7 to make it work). And since it isn't clear, 'classes' is the property of the collection of inlines, which can be collapsed or expanded, whereas 'inline_classes' is a property of the inlines themselves.
source: http://readthedocs.org/docs/django-grappelli/en/latest/customization.html#collapsibles
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With