<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Is it possible to add custom field parameters when defining a model<div>when using flask-mongoengine? (which in turn uses WTForms)<br><div><br></div><div>Example:</div><div><br></div><div>class Tasks(Document):</div><div>    task = StringField(max_length=128, my_custom_param="hello")</div><div>    completed = BooleanField(default=False)</div><div><br></div><div>The above will generate an error:</div><div><br></div><div><div>     flask_mongoengine/wtf/base.py", line 23, in __init__</div><div>        BaseField.__init__(self, **kwargs)</div><div>    TypeError: __init__() got an unexpected keyword argument 'my_custom_param'</div><div><br></div><div>Would it be a matter of defining or extending in the model __init__ method?</div><div><br></div><div>If it's possible, could anyone provide an example?</div><div><br></div><div><br></div><div>Thanks.</div><div><br></div><div>Jerry McCreary</div><div apple-content-edited="true">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div style="font-variant: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px;"><br class="Apple-interchange-newline"><font color="#d7d7d7">末末末末末末末末末</font></span></div><div style="color: rgb(0, 0, 0); font-variant: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br></div></div><br class="Apple-interchange-newline">
</div>
<br></div></div></body></html>