From d5ed3ced405194b72f7073d910d15b120bab0f8d Mon Sep 17 00:00:00 2001 From: Swen Kooij Date: Thu, 2 Feb 2017 17:08:06 +0200 Subject: [PATCH] Raise IntegrityError if it's not about the slug --- localized_fields/models.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/localized_fields/models.py b/localized_fields/models.py index c55e7b8..3e8fdcd 100644 --- a/localized_fields/models.py +++ b/localized_fields/models.py @@ -56,9 +56,11 @@ class LocalizedModel(models.Model): # field class... we can also not only catch exceptions # that apply to slug fields... so yea.. this is as # retarded as it gets... i am sorry :( - if 'slug' in str(ex): - if self.retries >= max_retries: - raise ex + if 'slug' not in str(ex): + raise ex + + if self.retries >= max_retries: + raise ex self.retries += 1 return self.save()