Example #1
0
def add_via_nfc(request):

    try:
        from notifier.push_notification import update_profile_notification
        user_id = request.data["id"]
        user = User.objects.get(pk=user_id)

        #create contact for receiver
        Contact.objects.create(contact_name=user.name, contact_number=user.mobile_number, user=request.user, is_on_contag=1,
                               contact_contag_user=user)

        #create contact for sender
        Contact.objects.create(contact_name=request.user.name, contact_number=request.user.mobile_number, user=user, is_on_contag=1,
                               contact_contag_user=request.user)

        #Add contact for sender via silent push notification
        update_profile_notification(for_user=user.id, profile_id=request.user.id)
        return JSONResponse([], status=200)
    except Exception as e:
        beam(e, request)
        return JSONResponse(ERROR_MESSAGE, status=400)
Example #2
0
 def update_local_contact_book(self):
     from notifier import push_notification
     print "Pushing notification to update their local contact book"
     push_notification.update_profile_notification(self.user.id, self.contact_contag_user.id)