Hello i have registered models like that
# models.py
class Property(models.Model):
address = models.TextField()
...
class PropertyImage(models.Model):
property = models.ForeignKey(Property, related_name='images')
image = models.ImageField()
is_front = models.BooleanField(default=False)
and:
# admin.py
class PropertyImageInline(admin.TabularInline):
model = PropertyImage
extra = 3
class PropertyAdmin(admin.ModelAdmin):
inlines = [ PropertyImageInline, ]
admin.site.register(Property, PropertyAdmin)
The is front picture is boolean so I know which will be the picture to be shown on the announces
Problem
I don't know how to make validation so I can throw an eror If 0 or more that 1 picture were chosen as is_front can you please help me with the admin form validation?
Thank you!