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