Error Was Cannot Import Name Validators
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies
Pip Install Flask-wtf
of this site About Us Learn more about Stack Overflow the company no module named wtforms Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges importerror: no module named flask_wtf Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute:
Flask-wtf Example
Sign up Django, unable to import validators in form class, getting “name 'validatorname' is not defined” up vote 1 down vote favorite I am trying to use validators in my form fields but am getting an error: from django import forms from django.db import models from django.core.exceptions import ValidationError class Register(forms.Form): username = forms.CharField(max_length=100,label="Username",validators=[validate_email]) >>>> name 'validate_email' is not defined I have
Flask Wtforms
tried this with a number of different validator types, only to be hit with the same message for each. I have looked over the documentation and really can't see what I am missing as to how to import the validators into the class, any advice is appreciated python django validation forms share|improve this question edited Sep 17 '10 at 22:14 asked Sep 17 '10 at 22:08 Rick 5,4072591148 add a comment| 1 Answer 1 active oldest votes up vote 4 down vote accepted You seem to be missing an import. Try adding from django.core.validators import validate_email to your imports share|improve this answer answered Sep 17 '10 at 22:18 Aurojit Panda 87169 Thanks, ok that makes sense.... just in the django docs I don't think its clear that you are supposed to import it this way so I was wondering about that, I am sure its mentioned somewhere else, just I was looking at: docs.djangoproject.com/en/1.2/ref/validators –Rick Sep 17 '10 at 22:20 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Face
von GoogleAnmeldenAusgeblendete FelderNach Gruppen oder Nachrichten suchen
Sign in Pricing Blog Support Search GitHub This repository Watch 9 Star 192 Fork 60 dstufft/django-passwords Code Issues 5 Pull requests 0 Projects 0 https://github.com/dstufft/django-passwords/issues/16 Pulse Graphs New issue Django 1.7, Python 3.4 ImportError: cannot import name 'smart_unicode' #16 Closed pavlov99 opened this Issue Apr 27, 2015 · 2 comments Projects None yet Labels None yet Milestone No milestone Assignees No one assigned 2 participants pavlov99 commented Apr 27, 2015 Hello everybody! I use python 3.4 and django 1.7. Library version no module is 0.3.1, installed from repository: git+git://github.com/dstufft/django-passwords.git@v0.3.1 This version raises ImportError: during from passwords.fields import PasswordField ... from passwords.validators import validate_length, common_sequences, dictionary_words, complexity ... from django.utils.encoding import smart_unicode ImportError: cannot import name 'smart_unicode' Thats because smart_unicode is supported only for python2: https://docs.djangoproject.com/en/1.7/ref/utils/#django.utils.encoding.smart_unicode Collaborator maccesch commented Apr 27, 2015 Which file does rise this ImportError? pavlov99 commented Apr 27, 2015 @maccesch no module named , it is "passwords/fields.py". As I checked, problem is with my version of django-passwords, it is 0.2.0 actually. For some reason pip failed to update the package. Following command tells that package is up to date. $ pip install --upgrade django-passwords Requirement already up-to-date: django-passwords in ./.env/lib/python3.4/site-packages However it is not: pip could not find correct distribution. $ pip install django-passwords==0.3.2 Collecting django-passwords==0.3.2 Could not find a version that satisfies the requirement django-passwords==0.3.2 (from versions: 0.2.0) No matching distribution found for django-passwords==0.3.2 Package reinstall solved the problem. I used v0.3.2 tag from this repository. pip install git+git://github.com/dstufft/django-passwords.git@v0.3.2 Anyway, thanks for quick response! pavlov99 closed this Apr 27, 2015 Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment Contact GitHub API Training Shop Blog About © 2016 GitHub, Inc. Terms Privacy Security Status Help You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.