Opened 9 years ago

Closed 9 years ago

#3267 closed defect (fixed)

[patch] textfield rendered as textarea

Reported by: Philipp Keller <philipp.keller@…> Owned by: adrian
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: UI/UX:

Description

enhancements:

  • models.py 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

bugfix:
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@…> 9 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 9 years ago by Philipp Keller <philipp.keller@…>

  • Summary changed from [patch] enhancements in models.py / textfield rendered as textarea to [patch] textfield rendered as textarea
  • Type changed from enhancement to defect
  • 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 9 years ago by Philipp Keller <philipp.keller@…>

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

comment:2 Changed 9 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

(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