Fix detail to django 1.6
This commit is contained in:
parent
6f53e6ac03
commit
6463dfd0f6
1 changed files with 6 additions and 2 deletions
|
@ -14,9 +14,10 @@
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
# 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/>.
|
# along with this programe. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
import django
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.text import capfirst
|
from django.utils.text import capfirst
|
||||||
from django.core import exceptions
|
from django.core import exceptions
|
||||||
|
@ -77,6 +78,9 @@ class MultiSelectField(models.CharField):
|
||||||
arr_choices = self.get_choices_selected(self.get_choices_default())
|
arr_choices = self.get_choices_selected(self.get_choices_default())
|
||||||
for opt_select in value:
|
for opt_select in value:
|
||||||
if (opt_select not in arr_choices):
|
if (opt_select not in arr_choices):
|
||||||
|
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)
|
raise exceptions.ValidationError(self.error_messages['invalid_choice'] % value)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue