Tuesday, June 29, 2010

Re: How To Create POST data without an actual POST?

Hi everyone,

Thanks for your responses. After some research on this, it looks like
urllib2 is the way to go. With this I can write a python program that
runs on any of our linux machines, and can do a GET to get info that
is similar to what the user sees in the forms (ie, defaults for
various fields). Then it will fill in the data supplied by the user,
then POST it back. This allows me to get all the same defaults that
people see in their forms, and also leverage all of the form
validation. So I think this will work well, thanks for all the input!

Margie


On Jun 28, 1:22 pm, Margie Roginski <margierogin...@yahoo.com> wrote:
> I'd like to find a way to let my users submit form data without
> submitting
> it via an actual web form. For example, I have users that would like
> to
> send their data via email, or perhaps provide it in an excel spread
> sheet,
>
> I'm trying to figure out how to do this and still leverage all the
> error
> checking associated with my forms (ie, via is_valid).
>
> I'm thinking that on the server side I could create a form with
> initial data,
> and then instead of rendering that form, I'd like to just convert it
> directly
> to a POST data dict, as if the user submitted the form without making
> any changes. Then I'd take that POST data, add a bit of additinal
> data
> that I've gotten from some other source (ie from email or excel), then
> run
> is_valid(), then do my standard save to my db object.
>
> Can anyone comment on if this seems like a good approach for doing
> this,
> and if so, if there is any django support for turning a form directly
> into a data dict?
>
> Thanks!
> Margie

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

No comments:

Post a Comment