Opened 13 years ago

Closed 13 years ago

#3267 closed defect (fixed)

[patch] textfield rendered as textarea

Reported by: Philipp Keller <philipp.keller@…> Owned by: Adrian Holovaty
Component: Forms Version: master
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no



  • takes modelfield.editable into account (fields with editable=false are not drawn and not considered during model/instance to form transformation)
  • a textfields default widget is now widgets.Textarea

When tranforming a model with a foreignkey field named "category" into a form with form_for_model/form_for_instance, posting that form, populating the posted data into this form and finally hitting save() on that form instance, the foreignfield won't be saved into db as in field "category" now is a unicode string, not a Category-Instance: "Invalid value: 'category' should be a <class 'icoc.extranet.models.Category'> instance, not a <type 'unicode'>".
I fixed this in mapping the column names to the db column names.
Though I'm not sure if this is at the right point of the process.

I ensured all the tests succeed.

Attachments (1)

newforms_textfield_rendered_as_textarea.diff (717 bytes) - added by Philipp Keller <philipp.keller@…> 13 years ago.
Exists only the "textfield rendered as textarea" part, forget the diff above

Download all attachments as: .zip

Change History (3)

comment:1 Changed 13 years ago by Philipp Keller <philipp.keller@…>

Summary: [patch] enhancements in / textfield rendered as textarea[patch] textfield rendered as textarea
Type: enhancementdefect
  • modelfield.editable already handled by Ticket 3247
  • foreignkey-bugfix already handled by Ticket 3257
  • textfield rendered as textarea still open, see new posted diff

Changed 13 years ago by Philipp Keller <philipp.keller@…>

Exists only the "textfield rendered as textarea" part, forget the diff above

comment:2 Changed 13 years ago by Adrian Holovaty

Resolution: fixed
Status: newclosed

(In [4305]) Fixed #3267 -- newforms: Changed database TextField to render as Textarea in form_for_model() forms. Thanks for the patch, Philipp Keller

Note: See TracTickets for help on using tickets.
Back to Top