Django admin: Adding validation in input field.

--

This is example of custom UI of Django admin like “CSS styles” or “Logo image”.

Custom theme and logo image

Apart from UI we also can custom form to add more validation in Django admin too.

For exmple in case of we allow user to use Django admin to add data then will use that data to render to html for frontend page, the problem is if customer add wrong data will make frontend page broke like this.

UI will broke it user not enter data like we want.

The solution is we can add validation in Djago admin page by override form in admin.py

Add validation of filed by “def clean_<field in model>”

Ref:
https://realpython.com/customize-django-admin-python/

If you think it’s useful for you, just clap your hands 👏 to be encouraged me.

GRASSROOT ENGINEER 😘

--

--

Grassroot Engineer
Grassroot Engineer

Written by Grassroot Engineer

ATM engineer who is interested in CODING and believe in EFFORT. — https://grassrootengineer.com

No responses yet