Skip to content

Commit

Permalink
Merge pull request #1 from saleem-latif/saleem-latif/fix-import-error…
Browse files Browse the repository at this point in the history
…-for-django-1.9

Fix ValidationError import in forms.py
  • Loading branch information
saleem-latif authored Jul 15, 2017
2 parents 780f034 + 5e4c046 commit b186098
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions json_field/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import json
except ImportError: # python < 2.6
from django.utils import simplejson as json
from django.forms import fields, util
from django.forms import fields, ValidationError

import datetime
from decimal import Decimal
Expand Down Expand Up @@ -45,9 +45,9 @@ def clean(self, value):
try:
value = json.dumps(eval(value, json_globals, json_locals), **self.encoder_kwargs)
except Exception as e: # eval can throw many different errors
raise util.ValidationError(str(e))
raise ValidationError(str(e))

try:
return json.loads(value, **self.decoder_kwargs)
except ValueError as e:
raise util.ValidationError(str(e))
raise ValidationError(str(e))

2 comments on commit b186098

@afausti
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @saleem-latif do you know if there's a pypi package with this fix?

@saleem-latif
Copy link
Owner Author

@saleem-latif saleem-latif commented on b186098 Jul 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@afausti This fix is not deployed to pypi, However, you can install it directly using

pip install git+https://github.com/saleem-latif/[email protected]

Please sign in to comment.