summaryrefslogtreecommitdiff
path: root/ishtar_common
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2022-08-05 13:56:28 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2022-12-12 12:23:17 +0100
commit371e2bbff3d9d71baeb2a26ab2c1ec9ad3a86a13 (patch)
tree2567ea29a01befbaa4ba84aea03a3f952875097f /ishtar_common
parent9945b83c5184a1c794f0e8b7ae854ff1c6a812b0 (diff)
downloadIshtar-371e2bbff3d9d71baeb2a26ab2c1ec9ad3a86a13.tar.bz2
Ishtar-371e2bbff3d9d71baeb2a26ab2c1ec9ad3a86a13.zip
Imports: add post importer actions in order to manage account importer
Diffstat (limited to 'ishtar_common')
-rw-r--r--ishtar_common/models.py11
-rw-r--r--ishtar_common/models_imports.py1
-rw-r--r--ishtar_common/version.py4
3 files changed, 14 insertions, 2 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index 9c139086b..0ee33d5ed 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -74,6 +74,7 @@ from django.template import Context, Template
from django.template.defaultfilters import slugify
from django.urls import reverse
from django.utils.functional import lazy
+from ishtar_common.data_importer import post_importer_action
from ishtar_common.utils import (
ugettext_lazy as _,
ugettext,
@@ -3383,6 +3384,16 @@ class IshtarUser(FullSearch):
def full_label(self):
return self.person.full_label()
+ @post_importer_action
+ def import_set_password(self, context, value):
+ self.user_ptr.set_password(value)
+ self.user_ptr.save()
+
+ @post_importer_action
+ def import_create_profile(self, context, value):
+ UserProfile.objects.get_or_create(person=self.person, profile_type=value,
+ defaults={"name":value.label})
+
post_save.connect(cached_label_changed, sender=IshtarUser)
diff --git a/ishtar_common/models_imports.py b/ishtar_common/models_imports.py
index 5cf672877..f7a35f849 100644
--- a/ishtar_common/models_imports.py
+++ b/ishtar_common/models_imports.py
@@ -876,6 +876,7 @@ TARGET_MODELS = [
("ishtar_common.models.SourceType", _("Source type")),
("AuthorType", _("Author type")),
("Format", _("Format")),
+ ("ProfileType", _("Profile type")),
("ishtar_common.models.Format", _("Format")),
("ishtar_common.models.LicenseType", _("License type")),
("ishtar_common.models.DocumentTag", _("Document tag")),
diff --git a/ishtar_common/version.py b/ishtar_common/version.py
index 80a1d2738..9425d458a 100644
--- a/ishtar_common/version.py
+++ b/ishtar_common/version.py
@@ -1,5 +1,5 @@
-# 4.0.12
-VERSION = (4, 0, 12)
+# 4.0.13
+VERSION = (4, 0, 13)
def get_version():