How to show only one image in Django admin inline

后端 未结 3 1933
我在风中等你
我在风中等你 2020-12-23 11:52

I\'m using django.contrib.admin in one of my apps.

my models:

class Gallery(models.Model):
    location = models.ForeignKey(Location)
           


        
3条回答
  •  Happy的楠姐
    2020-12-23 12:49

    Check the docs for InlineModelAdmin.extra and InlineModelAdmin.max_num.

    I believe in your case max_num needs to be 1 and extra 0.

提交回复
热议问题