8👍
✅
There is a way. This involves using a proxy model for one (or both) type of images. You can then add separate admins for the two. For e.g.
# models.py
class ProfileImage (Image):
class Meta:
proxy = True
class GalleryImage (Image):
class Meta:
proxy = True
This will avoid creating new tables. You’ll still be storing all the data in the table corresponding to the Image
model. You can then register two different admins for these proxies.
# admin.py
class ProfileImageAdmin (ImageAdmin):
def queryset(self, request):
qs = super(MyModelAdmin, self).queryset(request)
return qs.filter(type='profile')
class GalleryImageAdmin (ImageAdmin):
def queryset(self, request):
qs = super(MyModelAdmin, self).queryset(request)
return qs.filter(type='gallery')
admin.site.register(ProfileImage, ProfileImageAdmin)
admin.site.register(GalleryImage, GalleryImageAdmin)
Source:stackexchange.com