On Sep 30, 10:29 am, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> I strongly suspect you're debugging the wrong problem here.
>
> Regards,
> Malcolm
I am passing all the required arguments into the form. I wrote a
simple dispatcher that parses request.POST into a dictionary of the
form:
{model_name:{model_id:{model_field1:value, model_field2:value}}}
The dispatcher passes the dictionary to add, edit, and delete methods.
The edit method for example, first queries the database for all
objects with ids matching dictionary[model_name] and then for each obj
in the database queryset:
data = dictionary[model_name].pop(obj.id)
This yields, {model_field1:value, model_field2:value}
And using the obj from the database queryset,
form = MyForm(data, instance=obj)
Which then fails validation when I call form.is_valid()
However, if I use request.POST or my transform data into a QuerySet
subsequently passes validation, e.g.
data = QueryDict(query_dict_to_query_string({model_name:
{obj.id:data}}))
form = MyForm(data, instance=obj)
Luis.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---