summaryrefslogtreecommitdiff
path: root/ishtar_common/models_common.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/models_common.py')
-rw-r--r--ishtar_common/models_common.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py
index 10c564024..71efb0305 100644
--- a/ishtar_common/models_common.py
+++ b/ishtar_common/models_common.py
@@ -43,8 +43,8 @@ from django.db import connection, transaction, OperationalError, IntegrityError
from django.db.models import Q, Count, Max
from django.db.models.signals import post_save, post_delete, m2m_changed
from django.template import loader
-from django.template.defaultfilters import slugify
from django.utils.safestring import SafeText, mark_safe
+from django.utils.text import slugify
from django.utils.translation import activate, deactivate
from ishtar_common.utils import (
BColors,
@@ -684,16 +684,18 @@ class GeneralType(Cached, models.Model):
if self.pk:
old = self.__class__.objects.get(pk=self.pk)
content_type = ContentType.objects.get_for_model(self.__class__)
- if slugify(self.label) != slugify(old.label):
+ if slugify(self.label, allow_unicode=True) != slugify(old.label,
+ allow_unicode=True):
ItemKey.objects.filter(
- object_id=self.pk, key=slugify(old.label), content_type=content_type
+ object_id=self.pk, key=slugify(old.label, allow_unicode=True),
+ content_type=content_type
).delete()
if self.txt_idx != old.txt_idx:
ItemKey.objects.filter(
object_id=self.pk, key=old.txt_idx, content_type=content_type
).delete()
- obj = super(GeneralType, self).save(*args, **kwargs)
+ obj = super().save(*args, **kwargs)
self.generate_key(force=True)
return obj
@@ -725,7 +727,7 @@ class GeneralType(Cached, models.Model):
ItemKey.objects.get_or_create(**filtr)
def generate_key(self, force=False):
- for key in (slugify(self.label), self.txt_idx):
+ for key in (slugify(self.label, allow_unicode=True), self.txt_idx):
self.add_key(key)
def get_keys(self, current_import):