List Info

Thread: newforms __init__




newforms __init__
country flaguser name
United States
2007-08-30 09:34:43
Does anyone have a code example of __init__ where you modify
a
form_for_inst/model to remove some fields? I'm trying to
build an edit
form but don't want to expose all fields of the model. Maybe
I missed
it but I didn't see this scenario covered in the newforms
documentation.

Is this maybe not the right way to go about this kind of
scenario. I
thought of building a custom form that closely mirrors the
model and
then tying it into an instance at the end before saving.

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-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: newforms __init__
country flaguser name
United States
2007-08-30 09:40:24
ôÏ remove fields from from you don't need to use __init__
form_for_model, form_for_instance function has _fields_
parameter
where you can specify all the fields you need/ Example:

Form  = form_for_model( Article, fields = (
"title", "text",
"tags" ) )

Creates form with this three fields of model.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: newforms __init__
country flaguser name
United States
2007-08-30 09:53:18
Awesome. Thanks!

BTW it's right there in the documentation. Apologies.

http://www.djangoprojec
t.com/documentation/newforms/#using-a-subset-of-fields-on-th
e-form

On Aug 30, 3:40 pm, daev <daeva...gmail.com> wrote:
> То remove fields from from you don't need to use
__init__
> form_for_model, form_for_instance function has _fields_
parameter
> where you can specify all the fields you need/
Example:
>
> Form  = form_for_model( Article, fields = (
"title", "text",
> "tags" ) )
>
> Creates form with this three fields of model.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )