Fix detail to django 1.6

This commit is contained in:
Pablo Martín 2013-11-26 20:45:46 +01:00
parent 6f53e6ac03
commit 6463dfd0f6

View file

@ -14,9 +14,10 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this programe. If not, see <http://www.gnu.org/licenses/>.
import sys
import django
from django.db import models
from django.utils.text import capfirst
from django.core import exceptions
@ -77,7 +78,10 @@ class MultiSelectField(models.CharField):
arr_choices = self.get_choices_selected(self.get_choices_default())
for opt_select in value:
if (opt_select not in arr_choices):
raise exceptions.ValidationError(self.error_messages['invalid_choice'] % value)
if django.VERSION[0] >= 1 and django.VERSION[1] >= 6:
raise exceptions.ValidationError(self.error_messages['invalid_choice'] % {"value": value})
else:
raise exceptions.ValidationError(self.error_messages['invalid_choice'] % value)
return
def formfield(self, **kwargs):