Hi Django devs,

I want to share an idea with you and get some feedback in order to know if 
it makes sense, if it could solve a common problem and maybe evolve into an 
official GSoC proposal.

Some years ago I was working on a printing on demand website using Django 
1.2 and some model forms.
Our front-end guy designed a HTML form that had:
 - A *paper type* <select> tag with options: A4, A5
 - A *color* <select> tag with options: B&W, COLORS
The form must follow some business rules:
 - B&W available only for A4
 - COLORS available only for A5
(actually the original problem was a bit more complicated, but I'll keep it 
short...)

The solution I adopted was made of the following components.
 - A classic Django *model* and a *ModelForm* to manage and render the *paper 
type* and *color* form fields.
   Plus a Django *model* to implement the 2 rules.
 - A minimal *Javascript* code to detect an interaction of the user with 
the *paper type* or *color* field: when the user changed the selected value 
of *paper type* to f.i. A4, the entire form was sent back to Django using a 
AJAX request.
 - After receiving the edited form, Django checked the rules, disabled the 
unavailable options, COLORS in our case (by setting <option 
disabled="disabled" value="1">COLORS</option>), rendered the form to HTML 
and sent it back to the AJAX request.
   This behavior was implemented with a custom *form widget*.

With this solution users had a clear visual feedback on what the rules were.

Do you think this was a good design? Is there a better solution nowadays? 
Do you believe this could be a solution to a common problem? Could this 
idea evolve to a GSoC proposal (from myself of course)? Or maybe this idea 
is more likely a third-party library so it does not fit GSoC?
And about GSoC: this idea could maybe go together with the suggested 
"Finishing off Form Templates", which actually challenges me, but scares me 
at the same time since I'm not super experienced, plus the idea is marked 
as hard and someone already failed last year...

PS: That printing on demand website website is still up and running, so if 
I couldn't manage to be clear enough, I can link it here (I haven't done it 
because I don't want to spam)

Cheers,
Paolo

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/93f058ca-ba15-46ab-b49c-35b62c61f712%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to