Re: Outputting a default value for my TextField custom form manipulator html input ...

2007-03-16 Thread dbee

Thanks Benedict.

I just figured out a way to do what I wanted, and I thought I'd update
this thread for completion.

If you pass a dict to the form wrapper with the form field results,
the FormWrapper will parse the results in as default values ...

new_data = {
 'username': 'my_name',
 'phone_number': '0123456789'
   }

# Create the FormWrapper, template, context, response
form = forms.FormWrapper(manipulator, new_data, errors)

Argh...

There may be other ways to do it as well 

Anyway thanks :-)


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Outputting a default value for my TextField custom form manipulator html input ...

2007-03-16 Thread Benedict Verheyen

dbee schreef:
> I'm trying to output an account form, with the user's values already
> in place. So that if they wish to change any value, they can just
> change the  
> I'm using .95 with oldforms, and I can't seem to find anyway of
> outputting a default value with my form. That's a serious problem.
> 
> Neither the docs, nor the tutorials mention anything about it. I've
> had a look over the FormWrapper class and it mentions it. But it's not
> apparent how I can actually use it 
> 
> class FormWrapper(object):
> """
> A wrapper linking a Manipulator to the template system.
> This allows dictionary-style lookups of formfields. It also
> handles feeding
> prepopulated data and validation error messages to the formfield
> objects.
> """
> def __init__(self, manipulator, data, error_dict,
> edit_inline=True):
> self.manipulator, self.data = manipulator, data
> self.error_dict = error_dict
> self._inline_collections = None
> self.edit_inline = edit_inline
> 
> I've tried passing a list or a dict to data there, but it tells me
> that it's a non-keyword argument error or syntax error.
> 
> Can anyone help ?
> 

When i used oldforms, what i did to fill out a value in the form,
was to make my own manipulator and then initialise the data i wanted
by setting it via "default".
Here's an example that sets the actief field to True whenever users
tried to add an object.
addmanipulator.default["actief"] = True

Regards,
Benedict


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Outputting a default value for my TextField custom form manipulator html input ...

2007-03-16 Thread dbee

I'm trying to output an account form, with the user's values already
in place. So that if they wish to change any value, they can just
change the http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---