hello,

i'm a recent django developer. Sometime soon i will have to develop a
module for a cms solution to allow the content publishers to design
custom forms (including form layout) for webpages and to store the
results of the data of those forms.

the most obvious solution is to keep the form fields properties
(fk_form_id, field_id, label, type, length, required, order) in a
table (form_field) and the input data (fk_form_id, field_id,
user_answer) in another (form_field_answer).

The form itself (html) would be generated at runtime in the
front-office based on the form field properties and an action would
valdiate and capture that data (the POST) and save it to the database.

All of this completly detattched from a data model. The only data
model would the one required to save the form properties and user
input for that form.

The downfall of this is that:
- server-side validation has to be done manually
- the form controls html have to be coded manually using if's (if
field type is BLAH then show html for a BLAH input)
- all the user inputs for all forms are kept in a single database
table that can grow exponentially.

What i'm thinking about, if possible, was to keep only the form_field
table and with that data, generate a data model object on-the-fly (for
each form of course, with TextField, CharField, ..., properties and so
on) and use the django sub-system to (like if it was hard-coded the
usual way) :

- generate the SQL for the form table
- present the CRUD in the backoffice
- validate the datamodel after POST
- use django-forms in the front-office to generate the controls html,
by replacing tags like {FIELD_LABEL:field name 1} and
{FIELD_INPUT:field name 1} in a template with django-form widgets and
showing the result


because in not yet acquainted with the django code base, i'm asking
for your opinion.

thanks


display the form in the front-office by merging


-- 
José Moreira
Vila Nova de Gaia
Portugal

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to