How to add html data attribute in django charfield?

I have following code in model

password = models.CharField(
    max_length=32,
    null=True,
    blank=True,
    verbose_name="Code for downloaded Zip"
)

I'm using admin to modify data, I want to add data-lpignore="true" attribute when django-admin displays form.

I have added following code when I register model to admin which does not seems to work

formfield_overrides = {
    models.CharField: {"widget": 
    forms.TextInput(attrs={"data-lpignore": "True"})},
}

Any ideas about how to add this data attribute in my model itself?

Back to Top