How to show only one image in Django admin inline
django, django-admin
Solution
Check the docs for InlineModelAdmin.extra and InlineModelAdmin.max_num.
I believe in your case `max_num` needs to be 1 and `extra` 0.
Problem
I'm using `django.contrib.admin` in one of my apps. my models: ``` class Gallery(models.Model): location = models.ForeignKey(Location) date = models.CharField(max_length = 15) class Image(models.Model): gallery = models.ForeignKey(Gallery) name = models.CharField(max_length=35) image = ImageField(upload_to='songs') ``` my `admin.py`: ``` class ImageInline(admin.StackedInline): model = Image class GalleryAdmin(admin.ModelAdmin): inlines = [ ImageInline, ] ``` In the admin section I'm now able to create a gallery and add images on the same page. By default django shows three image upload forms. How can I change it to only one?