Skip to content

Commit

Permalink
Optimized index error generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
timster committed Nov 7, 2016
1 parent 4a3e2c9 commit 73d7d7d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions peewee_validates.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,11 +673,9 @@ def perform_index_validation(self, data):
if self.pk_field and self.pk_value:
query = query.where(self.pk_field != self.pk_value)
if query.count():
exc = ValidationError('index', fields=str.join(', ', index.keys()))
for col in index.keys():
try:
raise ValidationError('index', fields=str.join(', ', index.keys()))
except ValidationError as exc:
self.add_error(exc, col)
self.add_error(exc, col)

def save(self, force_insert=False):
delayed = {}
Expand Down

0 comments on commit 73d7d7d

Please sign in to comment.