[Django]-NameError: name 'RegexValidator' is not defined

12πŸ‘

βœ…

It’s basic Python that in order to use anything you need to either define it or import it in the current model. In your case, you need to do from django.core.validators import RegexValidator at the top of your models file.

For the second one, the error message tells you all you need to know: you need to install Pillow or (less preferably) PIL in your system. The documentation for ImageField mentions this and has the relevant links.

8πŸ‘

You might need to import it

 from django.core.validators import RegexValidator

also you need to install Pillow before you can use it

πŸ‘€Dr.Elch

Leave a comment