-
Notifications
You must be signed in to change notification settings - Fork 87
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
Flask Mongoengine WTForms update #812
Flask Mongoengine WTForms update #812
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -8,7 +8,7 @@ | |||
from flask_mongoengine.wtf import model_form # noqa | |||
|
|||
from flask_mongoengine.wtf.models import ModelForm as MEModelForm # noqa | |||
from flask_wtf import Form as WTForm # noqa | |||
from flask_wtf import FlaskForm # noqa |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#noqa
still valid?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was happy too to remove it but sadly this is here because of the mandatory early wtforms_json.init()
udata/tests/forms/test_uuid_field.py
Outdated
@@ -52,6 +51,7 @@ def test_with_valid_uuid_string(self): | |||
|
|||
form.populate_obj(fake) | |||
|
|||
print(type(fake.id)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remaining print
statement.
This PR supersedes #586, #654, #682 and #767 because they were dependent upgrades.
These PR have been merged into this one and all required fixes/refactorings applied:
flask_wtf.Form
is nowflask_wtf.FlaskForm
and has a little signature changeflask_mongoengine
has a new connection managerwtform-json
useStringField
instead of the deprecatedTextField
which breaks everyStringField
instance (inherited or not) using default value (pending bug fix: Fixes (Python 3.6, tox, StringField default, latest versions...) kvesteri/wtforms-json#49), casting value to something else than a string or expectedNone
as defaultConsequence:
mongoengine.get_db
instead of the removedflask_mongoengine.connection.get_db
None
as default/empty, inheriting fromStringField
but returning another type or using a default value now useudata.forms.field.Field
as base classForm(formdata, obj)
calls are nowForm(formdata, obj=obj)