summaryrefslogtreecommitdiff
path: root/ishtar_common/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r--ishtar_common/models.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index 814387bb4..c0888ec06 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -67,7 +67,6 @@ from ishtar_common.data_importer import Importer, ImportFormater, \
def post_save_user(sender, **kwargs):
user = kwargs['instance']
- ishtaruser = None
try:
q = IshtarUser.objects.filter(username=user.username)
if not q.count():
@@ -360,9 +359,9 @@ class GeneralType(Cached, models.Model):
:param slug: textual id
- :return: the id of the item
+ :return: id of the item (string)
"""
- return cls.get_or_create(slug).pk
+ return unicode(cls.get_or_create(slug).pk)
@classmethod
def get_or_create_pks(cls, slugs):
@@ -377,7 +376,7 @@ class GeneralType(Cached, models.Model):
items = []
for slug in slugs:
items.append(str(cls.get_or_create(slug).pk))
- return "_".join(items)
+ return u"_".join(items)
@classmethod
def get_help(cls, dct={}, exclude=[]):
@@ -1580,8 +1579,7 @@ class OrganizationType(GeneralType):
post_save.connect(post_save_cache, sender=OrganizationType)
post_delete.connect(post_save_cache, sender=OrganizationType)
-organization_type_lazy = lazy(OrganizationType.get_or_create, OrganizationType)
-organization_type_pk_lazy = lazy(OrganizationType.get_or_create_pk, int)
+organization_type_pk_lazy = lazy(OrganizationType.get_or_create_pk, unicode)
organization_type_pks_lazy = lazy(OrganizationType.get_or_create_pks, unicode)
IMPORTER_CLASSES = {}
@@ -2374,8 +2372,7 @@ class PersonType(GeneralType):
post_save.connect(post_save_cache, sender=PersonType)
post_delete.connect(post_save_cache, sender=PersonType)
-person_type_lazy = lazy(PersonType.get_or_create_pk, PersonType)
-person_type_pk_lazy = lazy(PersonType.get_or_create_pk, int)
+person_type_pk_lazy = lazy(PersonType.get_or_create_pk, unicode)
person_type_pks_lazy = lazy(PersonType.get_or_create_pks, unicode)