Linked Questions

Popular Questions

Validate Admin Inline form

Asked by At

I the Admin interface, I need to validate a field which is inside an Inline. Site has a name which has to be stored in lowercase.

How can I access to the name field in the inline to perform that validation?

I could also override its save method in models but I'd like to know how to do it in admin.

class SiteInline(admin.TabularInline):
    model = Site
    classes = ('grp-collapse grp-open',)
    inline_classes = ('grp-collapse grp-open',)

class CompanyAdmin(admin.ModelAdmin):
    ordering = ['name']
    inlines = (SiteInline, )

Related Questions