﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
14885	is_valid for ModelForm changes instance if instance is provided	italomaia	stumbles	"See this example:


{{{

def val_check(value):
  from django.core.exceptions import ValidationError
  raise ValidationError('Some reason')

class Model(models.Model):
  image = models.ImageField(upload_to='some/place', validators=[val_check(])

class ModelForm(forms.ModelForm):
  pass

def view(request, model_id):
  instance = Model.objects.get(pk=model_id)
  if request.method=='POST':
    form = ModelForm(request.POST, instance=instance)
  else: form = ModelForm(instance=instance)
  if form.is_bound and form.is_valid():
    form.save()
    # do something else
  return simple.direct_to_template(request, {'template':'some.html', 'extra_context':{'model':instance}})
}}}

In the example above, if i send a post request with some data for the field image, instance will be modified. If i use the value of instance in my 'some.html' i'll get invalid data in my template. This seems wrong. 

"	Cleanup/optimization	closed	Documentation	1.2	Normal	fixed	forms, is_valid, bad data	Torsten Bronger	Accepted	1	0	0	0	1	0
