On Wednesday, April 20, 2011 4:20:04 PM UTC+1, Dan wrote:
>
> I'm trying to create a Form Field, not a Model Field.
>
> The doc about creating a custom one is a tiny paragraph at the end of this 
> page: http://docs.djangoproject.com/en/1.3/ref/forms/fields/
>
> I read the source code of django but I'm having trouble even finding where 
> exactly is the value stored in the field.
>
> <http://docs.djangoproject.com/en/1.3/ref/forms/fields/>The problems I 
> have are that I don't know how to do the following:
>
>
>    - The field is going to receive an object and should render the name 
>    property of that object in html (so far, I can only render the id).
>    - The page is going to POST a string containing the name of the object 
>    (unique), it should be converted back to an object.
>
>
Rendering is the job of the widget, not the field. You will need to define a 
custom widget and make that the default for your field.

Converting a POSTed value is the job of the field's `clean()` method. 
--
DR.

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