NameError: name 'RegexValidator' is not defined
django, django-models, python, python-2.7
Solution
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.
Problem
This is the code from my models.py. ``` from django.db import models class Person(models.Model): contactNumber = models.IntegerField(max_length = 11, unique = True, validators = [[RegexValidator(regex='^\d{11}$', message='Length has to be 11 numbers including 0', code='Invalid number')]]) picture = models.ImageField(upload_to = 'folder_name', default = 'folder_name/default-image.jpg') jobTitle = models.CharField(max_length = 30) ``` When I run `python manage.py sql individual`, I get this error for the contactNumber field. `NameError: name 'RegexValidator' is not defined` and this error for the picture field. `django.core.exceptions.ImproperlyConfigured: Neither Pillow nor PIL could be imported: No module named Image` I am new to Python and Django. What should I do to get these two fields corrected?