Re: [mezzanine-users] custom Form processor

2015-03-06 Thread Stephen McDonald
What kind of initial data? You can actually use template code in the
"Default value" field for each form field, eg {{ request.user.username }}
or some such - so anything available in the template context.


On Fri, Mar 6, 2015 at 1:17 PM, Thomas  wrote:

>
> Hi all,
>
> First post here, super framework, really enjoying it and still finding
> awesome new features!
>
> I have created a custom Form processor and I am wondering if it is
> possible to pre-load the form fields dynamically with initial data using
> something like;
>
> form = FormForForm(page.form, RequestContext(request), initial=user_data)
>
>
>
> where user_data is a key-value dictionary containing the initial form
> field data, e.g.; {'field_name': 'field_value',}
>
> I have tried the scenario above but, the form fields are not pre-populated
> on page load. Also I am cannot bind the form to the data in user_data
> dictionary as it only contains a sub-set of the form fields and triggers
> validation errors for the remaining fields!
>
> Any help appreciated,
> Thanks,
> Thomas.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Mezzanine Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mezzanine-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Stephen McDonald
http://jupo.org

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[mezzanine-users] custom Form processor

2015-03-05 Thread Thomas

Hi all,

First post here, super framework, really enjoying it and still finding 
awesome new features!

I have created a custom Form processor and I am wondering if it is possible 
to pre-load the form fields dynamically with initial data using something 
like;

form = FormForForm(page.form, RequestContext(request), initial=user_data)



where user_data is a key-value dictionary containing the initial form field 
data, e.g.; {'field_name': 'field_value',}

I have tried the scenario above but, the form fields are not pre-populated 
on page load. Also I am cannot bind the form to the data in user_data 
dictionary as it only contains a sub-set of the form fields and triggers 
validation errors for the remaining fields!

Any help appreciated,
Thanks,
Thomas.

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.