On Tue, Nov 13, 2012 at 1:17 PM, Rohit Banga <iamrohitba...@gmail.com> wrote:
> Hi All
>
<snip>
>              model = ConcreteModel2
>              exclude = ('field3_test')
>
>
> Now as you can see there are parallels between the two model forms.
> The problem is that in my template field1 is visible for ConcreteModel1Form
> (expected behavior)

> But in another template field3 is not visible for ConcreteModel2Form
> (unexpected behavior).
>
> If I comment out exclude=('field3_test') then field3 is visible in the
> template (expected behavior) but form validation fails since field3_test is
> None and is a required field.
>
> What am I missing? This seems to be a problem with my code that i can't
> figure out. This behavior is clearly inconsistent and I am not able to see
> the difference in my code.
>
> Any ideas how to debug this? What could be the problem?
>
When we exclude a field from a form, that field become invisible. But
as we know, that it is mandatory to fill the foreign key value (else
the form will become invalid), so you should by some way give some
value to foreign key field.

-- 
Sandeep Kaur
E-Mail: mkaurkha...@gmail.com
Blog: sandymadaan.wordpress.com

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