[Answer]-ModelForm does not like receiving an instance

1👍

You are passing request.POST as positional argument user, request.user as keyword argument user. You’re doing something like following:

>>> def f(user, *args, **kwargs): pass
...
>>> f('post', user='user')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: f() got multiple values for keyword argument 'user'
>>> f('user', 'post')

Instead do following:

form = DogImageForm(request.user, request.POST, request.FILES, instance=instance)

Leave a comment