﻿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
26917	Disabled ModelChoiceFields crash in Django 1.10	karyon	Ryan Schave	"i have several tests that fail when trying to submit a form that has disabled fields in 1.10, which worked in 1.9, and also works when making it disabled=False. example stacktrace:

{{{
Traceback (most recent call last):
  File ""/vagrant/evap/staff/tests/test_forms.py"", line 105, in test_single_result_form_saves_participant_and_voter_count
    self.assertTrue(form.is_valid())
  File ""/vagrant/src/django/django/forms/forms.py"", line 161, in is_valid
    return self.is_bound and not self.errors
  File ""/vagrant/src/django/django/forms/forms.py"", line 153, in errors
    self.full_clean()
  File ""/vagrant/src/django/django/forms/forms.py"", line 364, in full_clean
    self._post_clean()
  File ""/vagrant/src/django/django/forms/models.py"", line 401, in _post_clean
    self.instance = construct_instance(self, self.instance, opts.fields, opts.exclude)
  File ""/vagrant/src/django/django/forms/models.py"", line 60, in construct_instance
    f.save_form_data(instance, cleaned_data[f.name])
  File ""/vagrant/src/django/django/db/models/fields/__init__.py"", line 867, in save_form_data
    setattr(instance, self.name, data)
  File ""/vagrant/src/django/django/db/models/fields/related_descriptors.py"", line 203, in __set__
    self.field.remote_field.model._meta.object_name,
ValueError: Cannot assign ""1"": ""Course.semester"" must be a ""Semester"" instance.
}}}

code for the form is [https://github.com/fsr-itse/EvaP/blob/b6222413f15fc7256622a31f7045046f7be1e466/evap/staff/forms.py#L149 here] (it's about the semester attribute, and ignore the two methods, this also fails when removing those) and test is [https://github.com/fsr-itse/EvaP/blob/b6222413f15fc7256622a31f7045046f7be1e466/evap/staff/tests/test_forms.py#L104 here].

this regressed in db19619545dd99a1d2502c72974d79eca33acff7."	Bug	closed	Forms	1.10	Release blocker	fixed		Claude Paroz	Accepted	1	0	0	0	0	0
