Skip to content
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

Update custom widget example in docs #226

Merged
merged 1 commit into from Aug 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions docs/widget.rst
Expand Up @@ -374,7 +374,8 @@ get defined as so:
if cstruct is null:
cstruct = u''
quoted = cgi.escape(cstruct, quote='"')
return u'<input type="text" value="%s">' % quoted
return ('<input type="text" name="%s" value="%s">' %
(field.name, quoted))

Note that every ``serialize`` method is responsible for returning a
serialization, no matter whether it is provided data by its caller or
Expand Down Expand Up @@ -446,7 +447,8 @@ attached.
def serialize(self, field, cstruct, readonly=False):
if cstruct is null:
cstruct = u''
return '<input type="text" value="%s">' % cgi.escape(cstruct)
return ('<input type="text" name="%s" value="%s">' %
(field.name, cgi.escape(cstruct, quote='"')))

def deserialize(self, field, pstruct):
if pstruct is null:
Expand Down Expand Up @@ -489,7 +491,8 @@ class:
def serialize(self, field, cstruct, readonly=False):
if cstruct is null:
cstruct = u''
return '<input type="text" value="%s">' % cgi.escape(cstruct)
return ('<input type="text" name="%s" value="%s">' %
(field.name, cgi.escape(cstruct, quote='"')))

def deserialize(self, field, pstruct):
if pstruct is null:
Expand Down