[Answer]-Django admin field class override for validation

1👍

I solved this by adding additional forms.ModelForm class like this:

class PersonForm(forms.ModelForm)
    phone = LTPhoneField()

class PersonAdmin(admin.ModelAdmin):
    form = PersonForm

admin.site.register(Person, PersonAdmin)

0👍

Try some thing like :

class PersonAdmin(admin.ModelAdmin):
    phone = LTPhoneField()
    def clean_phone(self):
        return self.cleaned_data["phone"]
admin.site.register(Person, PersonAdmin)

**Not Tested

Leave a comment