add missing signals.py

This commit is contained in:
Frédéric Péters 2019-05-19 16:40:20 +02:00
parent 9ec9e17c07
commit 5cd9d02cbc
1 changed files with 34 additions and 0 deletions

View File

@ -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 <http://www.gnu.org/licenses/>.
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