Ejemplo n.º 1
0
    def after_create_object(self, session, data, view_kwargs):
        """
        method to send email for creation of new session
        mails session link to the concerned user
        :param session:
        :param data:
        :param view_kwargs:
        :return:
        """
        if session.event.get_owner():
            event_name = session.event.name
            owner = session.event.get_owner()
            owner_email = owner.email
            event = session.event
            link = make_frontend_url("/events/{}/sessions/{}".format(
                event.identifier, session.id))
            send_email_new_session(owner_email, event_name, link)
            send_notif_new_session_organizer(owner, event_name, link,
                                             session.id)

        for speaker in session.speakers:
            session_speaker_link = SessionsSpeakersLink(
                session_state=session.state,
                session_id=session.id,
                event_id=session.event.id,
                speaker_id=speaker.id,
            )
            save_to_db(session_speaker_link, "Session Speaker Link Saved")
Ejemplo n.º 2
0
    def after_create_object(self, session, data, view_kwargs):
        """
        method to send email for creation of new session
        mails session link to the concerned user
        :param session:
        :param data:
        :param view_kwargs:
        :return:
        """

        for speaker in session.speakers:
            session_speaker_link = SessionsSpeakersLink(
                session_id=session.id,
                event_id=session.event.id,
                speaker_id=speaker.id,
            )
            save_to_db(session_speaker_link, "Session Speaker Link Saved")

        if session.event.get_owner():
            owner = session.event.get_owner()
            owner_email = owner.email
            if session.speakers:
                send_email_new_session(
                    owner_email, session,
                    session.speakers)  # TODO: Send to all organizers
            notify_new_session(session)
Ejemplo n.º 3
0
    def after_update_object(self, session, data, view_kwargs):
        """ Send email if session accepted or rejected """

        if data.get('send_email', None) and g.get('send_email'):
            notify_for_session(session)

        if 'state' in data:
            entry_count = SessionsSpeakersLink.query.filter_by(
                session_id=session.id)
            if entry_count.count() == 0:
                is_patch_request = False
            else:
                is_patch_request = True

            if not is_patch_request:
                current_session = Session.query.filter_by(
                    id=session.id).first()
                for speaker in current_session.speakers:
                    session_speaker_link = SessionsSpeakersLink(
                        session_id=session.id,
                        event_id=session.event.id,
                        speaker_id=speaker.id,
                    )
                    save_to_db(session_speaker_link,
                               "Session Speaker Link Saved")
                if current_session.event.get_owner(
                ) and current_session.speakers:
                    owner = session.event.get_owner()
                    owner_email = owner.email
                    send_email_new_session(owner_email, session,
                                           current_session.speakers
                                           )  # TODO: Send to all organizers
 def after_create_object(self, session, data, view_kwargs):
     """
     method to send email for creation of new session
     mails session link to the concerned user
     :param session:
     :param data:
     :param view_kwargs:
     :return:
     """
     if session.event.get_organizer():
         event_name = session.event.name
         organizer = session.event.get_organizer()
         organizer_email = organizer.email
         frontend_url = get_settings()['frontend_url']
         link = "{}/events/{}/sessions/{}"\
             .format(frontend_url, session.event_id, session.id)
         send_email_new_session(organizer_email, event_name, link)
         send_notif_new_session_organizer(organizer, event_name, link)
Ejemplo n.º 5
0
 def after_create_object(self, session, data, view_kwargs):
     """
     method to send email for creation of new session
     mails session link to the concerned user
     :param session:
     :param data:
     :param view_kwargs:
     :return:
     """
     if session.event.get_organizer():
         event_name = session.event.name
         organizer = session.event.get_organizer()
         organizer_email = organizer.email
         frontend_url = get_settings()['frontend_url']
         link = "{}/events/{}/sessions/{}"\
             .format(frontend_url, session.event_id, session.id)
         send_email_new_session(organizer_email, event_name, link)
         send_notif_new_session_organizer(organizer, event_name, link)