File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
curriculum/section14/lectures/14_edit_movies_pre_populate_wtform Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,22 @@ Note that the form pre-population mechanism is the `obj=movie` part.
54
54
55
55
## Rendering the extended movie form
56
56
57
- Let's create the ` templates/movie_form.html ` template:
57
+ First, let's edit the ` templates/macros/fields.html ` template to add the a new macro in order to render the custom field:
58
+
59
+ ``` jinja2
60
+ {% macro render_area_field(field) %}
61
+ <div class="form__group">
62
+ {{ field.label(class_="form__label") }}
63
+ {{ field(rows=4, class_="form__field", style="resize: none") }}
64
+
65
+ {%- for error in field.errors %}
66
+ <span class="form__error">{{ error }}</span>
67
+ {% endfor %}
68
+ </div>
69
+ {% endmacro %}
70
+ ```
71
+
72
+ And then create the ` templates/movie_form.html ` template:
58
73
59
74
``` jinja2
60
75
{% from "macros/fields.html" import render_text_field, render_area_field %}
You can’t perform that action at this time.
0 commit comments