Opened 18 years ago

Closed 18 years ago

#3334 closed (fixed)

Dynamic Creation of newforms Persists field data

Reported by: Deryck Hodge <deryck@…> Owned by: Adrian Holovaty
Component: Forms Version: dev
Severity: Keywords:
Cc: deryck@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Attached is a patch to the tests for newforms, showing that when passing in fields to dynamically created forms, the fields are persisting across multiple instances of the form.

The current test fails as attached, returning field1, field2, field3, and field4 on the second print statement, when it should just return field3 and field4.

Attachments (1)

form_tests.diff (1.8 KB ) - added by Deryck Hodge <deryck@…> 18 years ago.
A patch to tests/regressiontests/forms/tests.py to test instances of dynamically created forms return the right fields.

Download all attachments as: .zip

Change History (3)

by Deryck Hodge <deryck@…>, 18 years ago

Attachment: form_tests.diff added

A patch to tests/regressiontests/forms/tests.py to test instances of dynamically created forms return the right fields.

comment:1 by Adrian Holovaty, 18 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Adrian Holovaty, 18 years ago

Resolution: fixed
Status: newclosed

(In [4437]) Fixed #3334 -- Changed newforms Form class construction so that appending to (or altering) self.fields affects only the instance, not the class. As a consequence, self.fields is created in Form.init(). The form metaclass now creates a variable self.base_fields instead of self.fields.

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