Comments (2)
Validation takes place at field level. The form itself can't tell if the document is unique. It would need to query the DB. That's not something WTForms does.
I've been facing the same issue. For now, I've left it aside and I catch NotUniqueError in the controller, but perhaps I could setup a function to query the DB and wrap this into a custom validator.
Suggestions welcome.
from flask-mongoengine.
Agreed w/ @lafrech that this is not something that the form validation should deal with. Catching mongoengine.errors.NotUniqueError
and then responding with a validation error message sounds like a perfectly fine approach.
from flask-mongoengine.
Related Issues (20)
- Mongo Debug Toolbar Panel: Update HTML view to enable scrolling
- Mongo Debug Toolbar Panel: Update HTML view to use wide screens
- Test database stays in place after tests!
- Add docs to new connection module #429 and new installation #475 HOT 1
- Migration to 2.0.0 documentation HOT 1
- Include Pillow as extra option for ImageField support?
- Ensure typing statements will not cause strong dependency on Flask-Debug Panel or WTForms
- Incompatibility with current flask version (2.2) HOT 7
- MongoEngine models Field missing HOT 2
- DecimalField: pass places to widget?
- New JSONProvider use of super() not quite right HOT 1
- AttributeError: type object 'Collection' has no attribute 'insert' HOT 3
- MongoEngine saving to a database called 'test' instead of database specified HOT 1
- Regarding new release HOT 8
- Config `db` cover host info
- after configuring database getting error mongoengine.connection.ConnectionFailure: You have not defined a default connection
- Failing debug_toolbar from subdomain (under https loads static files with http - blocked by browser) HOT 1
- Flask2.3.X JSONEncoder deprecated HOT 7
- This is a dead project - DO NOT USE HOT 7
- New Fork
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flask-mongoengine.