From 371e2bbff3d9d71baeb2a26ab2c1ec9ad3a86a13 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 5 Aug 2022 13:56:28 +0200 Subject: Imports: add post importer actions in order to manage account importer --- ishtar_common/models.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'ishtar_common/models.py') 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) -- cgit v1.2.3