Show some code how you create these forms.

Django creates QueryDict 
<https://docs.djangoproject.com/ja/1.9/ref/request-response/#querydict-objects> 
objects for request.POST and request.GET which are *immutable*, so mu guess 
is that some times you are instancing the form with either request.POST or 
request.GET and another time (when you have an AJAX call) you are 
instantiating the forms with a simple dict object (created from json.loads) 
which is *mutable*.

However, I don't think that it's a good idea to change form.data, whats the 
purpose behind it? probably there is a better way.

On Saturday, August 6, 2016 at 3:42:29 PM UTC+3, Petar Aleksic wrote:
>
> Hi,
>
> Basically in two different UpdateViews I update the form kwargs 
> dinamically (on the same way):
>
> def get_form_kwargs(self):
>         kwargs = super(MyView, self).get_form_kwargs()
>         print("KWARGS", kwargs)
>         kwargs['data'].update({
>             "something": "somevalue"
>         })
>         return kwargs
>
>
> But one view raises* AttributeError: This QueryDict instance is immutable* 
> and another doesn't. 
> I might add that views are called with ajax but, as mentioned, no 
> difference in way calls are triggered. 
>
> Anybody has an idea what might be the cause or had a similar problem?
>
> Best
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ce28d8af-8158-4ef0-ac8b-e19fabecbeee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to