summaryrefslogtreecommitdiff
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
commita25605b9c1fd64806c4e3cf76936b65107d83a2e (patch)
tree2567ea29a01befbaa4ba84aea03a3f952875097f
parent3c743fcb4de71ea3406ded002a77fe811e13b7cf (diff)
downloadIshtar-a25605b9c1fd64806c4e3cf76936b65107d83a2e.tar.bz2
Ishtar-a25605b9c1fd64806c4e3cf76936b65107d83a2e.zip
Imports: add post importer actions in order to manage account importer
-rw-r--r--CHANGES.md8
-rw-r--r--ishtar_common/models.py11
-rw-r--r--ishtar_common/models_imports.py1
-rw-r--r--ishtar_common/version.py4
4 files changed, 22 insertions, 2 deletions
diff --git a/CHANGES.md b/CHANGES.md
index a24159059..ec1e95b4d 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -6,6 +6,14 @@ date: 2022-08-05
Ishtar changelog
================
+v4.0.13 - 2022-08-05
+--------------------
+
+### Bug fix ###
+
+- Imports: CSV check fix encoding check
+- Imports: add post importer actions in order to manage account importer
+
v4.0.12 - 2022-08-05
--------------------
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():