File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ def __init__(self, converters=None):
38
38
def convert (self , model , field , field_args ):
39
39
kwargs = {
40
40
'label' : getattr (field , 'verbose_name' , field .name ),
41
- 'description' : '' ,
41
+ 'description' : field . help_text or '' ,
42
42
'validators' : [],
43
43
'filters' : [],
44
44
'default' : field .default ,
Original file line number Diff line number Diff line change @@ -247,5 +247,20 @@ class DogOwner(db.Document):
247
247
self .assertIsNotNone (m , "Should have one selected option" )
248
248
self .assertEqual ("fido" , m .group (1 ))
249
249
250
+ def test_model_form_help_text (self ):
251
+ with self .app .test_request_context ('/' ):
252
+ db = self .db
253
+
254
+ class BlogPost (db .Document ):
255
+ title = db .StringField (required = True , help_text = "Some imaginative title to set the world on fire" )
256
+
257
+ post = BlogPost (title = "hello world" ).save ()
258
+
259
+ BlogPostForm = model_form (BlogPost )
260
+ form = BlogPostForm (instance = post )
261
+
262
+ self .assertEqual (form .title .description , "Some imaginative title to set the world on fire" )
263
+
264
+
250
265
if __name__ == '__main__' :
251
266
unittest .main ()
You can’t perform that action at this time.
0 commit comments