Thursday, May 10, 2012

Re: Custom field names in ModelForm

Thanks for the reply Rajneesh, but I'm looking for a more scalable option.
(Ideally I would like to write a wrapper of some kind which does the task regardless of which Model is it)
My use case is that I'm using django-piston for building a REST API, which I tweaked to give me what I wanted (http://rockerhome.wordpress.com/2012/05/06/hacking-django-piston/)
Since I'm exposing different field names to the external world as mentioned in my post, I want to validate those while still continuing to use the django Forms/ModelForms for validation of submitted data for data updation. It has to work for partial updates too.

I don't know if I was able to explain myself.
Let me know.

On Friday, May 11, 2012 12:17:54 AM UTC+5:30, Rajeesh Nair wrote:

Is there a way to customize the field name (not just label) while creating a ModelForm?


Override the change_form template for the concerned model and put the label for the field
in whatever way you like. Check out the django-templates documentation to know how to
do this.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/WHRyTcVzD_EJ.
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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate