-
Notifications
You must be signed in to change notification settings - Fork 251
Model form generator now accepts wtf custom 'validators' and 'filters' on model field definition. #147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Changes made to accept pre-defined field filters and validators if any. This enable validators and filters to be set against flask-mongoengine wtf fields.
Reverted changes made to filters.
mongoengine.base.fields.BaseField - it provides flask-mongoengine wtf to extend on the field parameters and settings on behalf of wtf model form generator. We achieve this by monkey patch all mongoengine fields classes whose base class is BaseField at __init__ of flask-mongoengine. Feature:
Also added basic validation method in WtfBaseField to ensure the both submitted 'validators' and 'filters' are list values or callables.
|
Hi @rozza, Do you have a timeline for this merge. Do you want me to do anything to get it accepted. I do believe it will resolve some the current tickets and also as an added feature. |
|
@losintikfos I'm really sorry I don't have the bandwidth - but I have invited you to the organisation - so feel free to check the build and merge :) |
|
@rozza Thanks |
Model form generator now accepts wtf custom 'validators' and 'filters' on model field definition.
|
@losintikfos seems what you broke something. |
|
@dizballanze thanks for reporting this - I am having a quick look into this. |
|
@dizballanze update your local version with the fix and try again - thanks. |
|
@losintikfos problem solved - thanks! 😸 |
|
Hi @dizballanze, I just pushed a fix to handle both validators and filters. Can you please update your version and confirm it still works fine. Thanks |
|
@losintikfos I have checked, it still works. |
|
@dizballanze Thanks. |
Added a wrapper sub-class WtfBaseField to allow additional WTForm field parameters and settings needed by flask-mongoengine, without necessarily going through to the core mongoengine BaseField.
flask_mongoengine/__init__.pyhas patching to redirect wtf mongoengine Fields of base BaseField to use WtfBaseFieldwtf/orm.pynow has 'validators' and 'filters' allowed on behalf wtf model field generator.Example: