Skip to content
This repository was archived by the owner on Oct 5, 2022. It is now read-only.

[Draftail fix] Pass field values through widget.format_value() #56

Merged
merged 1 commit into from
Nov 20, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Pass field values through widget.format_value()
Fixes #51

This allows the code within Wagtail's Draftail widget that converts the
internal HTML format into JSON to run.

https://github.com/wagtail/wagtail/blob/72bc5fff6f6d12daf1dc8dc630a3159dafd30e5b/wagtail/admin/rich_text/editors/draftail/__init__.py#L51-L59
  • Loading branch information
kaedroho committed Nov 19, 2018
commit fc566eea9f986cf7626ac5c394acd6a4684eee97
4 changes: 2 additions & 2 deletions condensedinlinepanel/edit_handlers.py
Original file line number Diff line number Diff line change
@@ -140,7 +140,7 @@ def get_form_extra_data(form):
'id': i,
'instanceAsStr': six.text_type(form.instance),
'fields': {
field_name: form[field_name].value()
field_name: form[field_name].field.widget.format_value(form[field_name].value())
for field_name in form.fields.keys()
},
'extra': get_form_extra_data(form),
@@ -156,7 +156,7 @@ def get_form_extra_data(form):
],
'emptyForm': {
'fields': {
field_name: self.empty_form[field_name].value()
field_name: self.empty_form[field_name].field.widget.format_value(self.empty_form[field_name].value())
for field_name in self.empty_form.fields.keys()
}
}