From 5cd9d02cbc6071165f5fe6dc8ea6e3bf55ad4a7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Sun, 19 May 2019 16:40:20 +0200 Subject: [PATCH] add missing signals.py --- combo_plugin_gnm/signals.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 combo_plugin_gnm/signals.py diff --git a/combo_plugin_gnm/signals.py b/combo_plugin_gnm/signals.py new file mode 100644 index 0000000..40e5c02 --- /dev/null +++ b/combo_plugin_gnm/signals.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +# combo-plugin-gnm - Combo GNM plugin +# Copyright (C) 2017-2019 Entr'ouvert +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU Affero General Public License as published +# by the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +from django.db.models.signals import post_save +from django.dispatch import receiver + +from combo.middleware import get_request +from combo.profile.models import Profile + +@receiver(post_save, sender=Profile) +def new_profile(sender, instance=None, created=False, **kwargs): + if not created: + return + request = get_request() + saml_info = request.session.get('mellon_session', {}) + if False: + # if profile has an address push it to the favourite places datastore + saml_info['address'][0] + + # fill dashboard with suggestions