How to bind to a single entity a few pictures?

Good day !
There is a model:
class ShopCat(models.Model):
 title = models.CharField(max_length=100)

 def __unicode__(self):
 return self.title


class ShopItem(models.Model):
 cat_id = models.ForeignKey(ShopCat)
 title = models.CharField(max_length=100)
 sostav = models.TextField(max_length=1000)
 descr = models.TextField(max_length=1000)
 creation_date = models.DateTimeField(auto_now_add=True, auto_now=False)
 updated = models.DateTimeField(auto_now_add=False, auto_now=False, blank=True, null=True)
 price = models.IntegerField()

 def __unicode__(self):
 return self.title


class ShopItemImg(models.Model):
 ShopItem_id = models.ForeignKey(ShopItem)
 img = models.ImageField(upload_to='shop/', null=True, blank=True)


And admin.py write:
class ShopItemImgInline(admin.ModelAdmin):
 model = ShopItemImg
 extra = 3

class ShopItemAdmin(admin.ModelAdmin):
 fieldsets = [
 (None, {'fields': ['title', 'cat_id', 'price']}),
 ("Texts", {'fields': ['descr', 'sostav']}),
]

admin.site.register(ShopItem, ShopItemAdmin)
admin.site.register(ShopCat)
admin.site.register(ShopItemImg, ShopItemImgInline)


Everything works fine, BUT
When you try to ShopItemImgInline admin class(admin.ModelAdmin) change the ModelAdmin for StackedInline or TabularInline - error : AttributeError: 'ShopItemImgInline' object has no attribute 'urls'

Tell me - where nakosyachil ?
July 9th 19 at 11:08
1 answer
July 9th 19 at 11:10
Solution
He figured
The mistake was that I checked in the admin.site.register(ShopItemImg, ShopItemImgInline)
But it was not necessary )
If anyone is interested - here is a working version of the admin:
# -*- coding: utf-8 -*-
from django.contrib import admin
from .models import ShopCat, ShopItem, ShopItemImg


class ShopItemImgInline(admin.TabularInline):
 model = ShopItemImg


class ShopItemAdmin(admin.ModelAdmin):
 fieldsets = [
 (None, {'fields': ['title', 'cat_id', 'price']}),
 ("Texts", {'fields': ['descr', 'sostav']}),
]
 inlines = [ShopItemImgInline]


admin.site.register(ShopItem, ShopItemAdmin)
admin.site.register(ShopCat)

Find more questions by tags Django