1👍
✅
This import is not valid, so is raising ImportError
:
from django.contrib.admin.validation import validate
The module django.contrib.admin.validation
does not contain a function validate
. It has a BaseValidator
object which has a validate
method.
It’s not clear to me why you’re trying to import validate
anyway. Try removing the import, and the line where you call validate
from your template tag.
For your second error, you need to make sure that the request
is in the template context. The easiest way of doing this is to add the request template context processor to your TEMPLATE_CONTEXT_PROCESSORS
setting.
Source:stackexchange.com