My basic problem is this: I have multiple kinds of requests that come in,
and some of them share parameters and valid values and default values. I
cannot expect my users to pass all form values on the URL line, but
unpassed parameters must be set to appropriate defaults, not merely None.

These shared parameter sets are broken out into separate RequestForm
classes, but I also wanted to put the parsing and default values into those
classes. So I came up with the "from_request" method, which I put into each
RequestForm subclass and created a class method called "create" in
RequestForm that class every class in cls.mro()'s from_request method
independently, then calls .clean() on the form to validate it.

Another caveat is that I must shadow the request.GET dictionary with a
case-insensitive dictionary, which I take care of in the
django.views.generic.View.dispatch() method.

The code for my proposed solution is here:

http://dpaste.com/hold/689872/

Does this make sense to people?  Sorry to kind of flood the list with this
problem all day in different forms, but i think I'm close to having
something I like.

-- Jeff

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to