#9547 closed (invalid)
Need better support for dynamic forms
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Forms | Version: | 1.0 |
Severity: | Keywords: | dynamic forms | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When creating a static form, the Forms support in django works great. However, when trying to create a dynamic form (i.e. a survey is a good example), it seems very difficult. It would be nice if I could create a Form instance and add fields at runtime. Of course, validations and handling the postback would need to work also for dynamic forms. Thanks!
Change History (3)
comment:1 by , 16 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 by , 16 years ago
Oh, I just realized my code above as a bug. It should be forms.BaseForm
and not forms.Form
:)
comment:3 by , 16 years ago
Thanks for the comment. I wasn't sure the best place to share my opinion, so I apologize if I posted it in the wrong place. I am not familiar with dynamic classes in Python, but that sounds interesting. In my research of django, I found many forums with django users that were confused about dynamic forms. Some claimed it was impossible. So that's why I decided to contact the "experts". =) Thanks again.
Are you actually proposing a specific fix? This is already possible. Django's forms are just Python classes. You can easily create runtime classes using Python's
type
function. I would recommend reading up on how Python works in that respect.base_fields
is where your runtime fields are created. I am marking this as invalid. I would consider proposing an actual fix or improvement to django-developers before opening a drive by ticket. Thanks :)