Hi,
   I have the following scenario.
   I am creating a custom admin page for one of the models. I am
adding few extra fields. If the extra fields are set, then the user
does not need to set the model fields. An example is given below:

Model A:
    val1 models.ForeignKey(A1)
    val2 models.ForeignKey(A2)
    val3 models.CharField()

Form F:
    val_x_1 forms.CharField()

Now, on the add/change page for Model A, I am giving an option. It
would look like the following:

Add A:
------------------
val_x_1:    [________]
val2:       [________]
--------------------------------------------
              OR
--------------------------------------------
val1:       [________]
val2:       [________]
val3:       [________]

[Save] [Save and Add Another]

The user can either type in val1, val2 and val3 or he can put in
values in val_x_1 and val2 only, and my custom add_view should take
care of everything.

Now, the whole page is working fine. But, I am unable to update
request.POST to set up values for val1, val2 and val3 based on the
values val_x_1 and val2. I created a mutable copy and tried putting
that copy back to request.POST, but everytime I am getting the 'cant
adapt' error. The backend is PostgreSQL.

If I dont update request.POST, the form.validate would fail inside the
proper add_view. I cannot make it as blank=True straightaway because
if the val_x_1 and val2 is not updated by the user, he needs to update
mandatorily val1, val2 and val3.

Can anyone help me on this?

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