Esempio n. 1
0
def create(current_user, user_id, limit=4, page=1):
    """ Method to create event."""
    event = request.get_json()
    name=event['name'].strip()
    category=event['category']
    location=event['location']
    date=event['date']
    description=event['description']
    new_event = validate_data(event)
    if new_event is not event:
        return jsonify({"message":new_event}), 400
    existing=Events.query.filter_by(name=name).filter_by(category=category).filter_by\
    (created_by=user_id).filter_by(location=location).first()
    if existing:
        response = {"message" : "A similar event already exists!"}
        return make_response(jsonify(response)), 302    
    try:
        created_event = Events(name=name, category=category, location=location,
        date=date, description=description, created_by = user_id)
        created_event.save()
        response = jsonify({
            'id': created_event.id, 'name' : created_event.name, 'category' : created_event.category,
            'location' : created_event.location, 'date' : created_event.date,
            'description' : created_event.description, 'created_by' : created_event.created_by,
            'message': 'Event successfully created'
        })
    except KeyError:
        response = {"message": "There was an error creating the event, please try again"}
        return make_response(jsonify(response)), 500                            
    return make_response(response), 201
Esempio n. 2
0
def create():
    """a route to handle creating an event"""
    event_details = request.get_json()
    check_details = validate_data(event_details)
    check_date = validate_date(event_details['event_date'])
    #check if the data was confirmed valid
    if check_details is not "valid":
        return jsonify({"message" : check_details}), 400
    elif check_date is not "valid":
        return jsonify({"message" : check_date}), 400
    else:
        name = event_details['name']
        description = event_details['description']
        category = event_details['category']
        location = event_details['location']
        event_date = event_details['event_date']
        created_by = g.user
        #check if the user has an event with a similar name and location
        existing_event = [event for event in g.user.events if event.name == name \
            and event.location == location]
        if not existing_event:
            #create the event if does not exist
            event = Events(name=name, description=description, category=category, \
                location=location, event_date=event_date, created_by=created_by)
            event.save()
            res = event.to_json()
            return jsonify(res), 201
        return jsonify({"message" : "you have a similar event in the same location"}), 302
Esempio n. 3
0
def events_filter():
    """filter events by location or category"""
    #get the incoming parameters
    location = request.args.get("location")
    category = request.args.get("category")
    #get the given page and number of events or set them to default
    page = request.args.get("page", default=1, type=int)
    per_page = request.args.get("limit", default=15, type=int)
    #check which parameter was given and use it to query the database
    if location and category:
        #if both location and category have been given,filter by both
        found_events = Events.filter_events(location, category, page, per_page)
        if found_events.items:
            event_list = make_event_list(found_events.items)
            return jsonify(event_list), 200
        return jsonify({"message" : "there are no more {} events in {}".format(category, location)}), 404
    elif location:
        found_events = Events.get_events_by_location(location, page, per_page)
        if found_events.items:
            event_list = make_event_list(found_events.items)
            return jsonify(event_list), 200
        return jsonify({"message" : "there are no more events in {}".format(location)}), 404
    elif category:
        found_events = Events.get_events_by_category(category, page, per_page)
        if found_events.items:
            event_list = make_event_list(found_events.items)
            return jsonify(event_list), 200
        return jsonify({"message" : "there are no more {} events".format(category)}), 404
    else:
        return jsonify({"message" : "can not search events with the given parameter"}), 400
Esempio n. 4
0
def create_contact_record(request, first_name, last_name, email, subject,
                          message):
    """
    Creates Users, Emails, and Events entries for a contact submission for a request.
    Sends email with message to all agency users associated with the request.

    :param request: request object
    :param first_name: sender's first name
    :param last_name: sender's last name
    :param email: sender's email
    :param subject: subject of email
    :param message: email body
    """
    if current_user == request.requester:
        user = current_user
    else:
        user = Users(guid=generate_guid(),
                     email=email,
                     first_name=first_name,
                     last_name=last_name,
                     email_validated=False,
                     terms_of_use_accepted=False,
                     is_anonymous_requester=True)
        create_object(user)

        create_object(
            Events(request_id=request.id,
                   user_guid=None,
                   type_=event_type.USER_CREATED,
                   new_value=user.val_for_events))

    body = "Name: {} {}\n\nEmail: {}\n\nSubject: {}\n\nMessage:\n{}".format(
        first_name, last_name, email, subject, message)

    agency_emails = get_assigned_users_emails(request.id)

    email_obj = Emails(request.id,
                       PRIVATE,
                       to=','.join([
                           email.replace('{', '').replace('}', '')
                           for email in agency_emails
                       ]),
                       cc=None,
                       bcc=None,
                       subject=subject,
                       body=body)

    create_object(email_obj)

    create_object(
        Events(request_id=request.id,
               user_guid=user.guid,
               type_=event_type.CONTACT_EMAIL_SENT,
               response_id=email_obj.id,
               new_value=email_obj.val_for_events))

    send_contact_email(subject, agency_emails, message, email)
Esempio n. 5
0
def events():
    """getting all events pertaining a user"""
    if request.method == 'POST':
        event = request.args.get('event')
        if Events.create_event(event) == "That event already exists":
            return jsonify({'message': 'That event already exists'})
        else:
            if Events.create_event(event) == "Event added":
                return jsonify("Event Added")
    else:
        if Events.get_events() == "You do not have events":
            return jsonify({'message': 'You do not have events'})
        else:
            if Events.get_events() == "There are no events":
                return jsonify({'message': 'There are no events to show'})
Esempio n. 6
0
def addevent():
  form = NewEventForm(request.form)
  if request.method == 'POST' and form.validate_on_submit():
     #user = User(form.first_name.data, form.last_name.data, form.username.data,
     #            form.username.data, form.email.data, form.enrollment.data,
     #            form.college_name.data)
     event = Events(form.event_name.data, form.address.data, form.fees.data)
     event.start_date = form.start_date.data
     event.end_date = form.end_date.data

     db.session.add(event)
     db.session.commit()

     return render_template('addevent.html',isadded=True)
  return render_template('addevent.html',form=form, isadded=False)
Esempio n. 7
0
def addevent():
    form = NewEventForm(request.form)
    if request.method == 'POST' and form.validate_on_submit():
        #user = User(form.first_name.data, form.last_name.data, form.username.data,
        #            form.username.data, form.email.data, form.enrollment.data,
        #            form.college_name.data)
        event = Events(form.event_name.data, form.address.data, form.fees.data)
        event.start_date = form.start_date.data
        event.end_date = form.end_date.data

        db.session.add(event)
        db.session.commit()

        return render_template('addevent.html', isadded=True)
    return render_template('addevent.html', form=form, isadded=False)
Esempio n. 8
0
def manipulate_event(event_id):
    """update or delete an event"""
    event = Events.get_event_by_id(event_id)
    if event:
        #maeke sure the events is modified by the right person
        if event.created_by.username == g.user.username:
            if request.method == 'PUT': 
                event_details = request.get_json() #get the incoming details
                #update the details accordingly
                event.name = event_details['name']
                event.description = event_details['description']
                event.category = event_details['category']
                event.location = event_details['location']
                event.event_date = event_details['event_date']
                #save the event back to the database
                event.save()
                return jsonify({"message" : "event updated successfully"}), 200
            elif request.method == 'GET':
                #return the event with the given id
                found_event = event.to_json()
                return jsonify(found_event), 200
            else:
            #if the request method is delete
                event.delete()
                return jsonify({"message" : "event deleted successfully"}), 200
        return jsonify({"message" : "you can not modify the event"})
    return jsonify({"message" : "no event with given id found"}), 404
Esempio n. 9
0
def create_user_request_event_object(events_type,
                                     user_request,
                                     old_permissions=None,
                                     old_point_of_contact=None,
                                     user=current_user):
    """
    Create an Event for the addition, removal, or updating of a UserRequest and insert into the database.

    Args:
        events_type (str): event type from the constants defined in constants.event_type.
        user_request (UserRequests): UserRequests object.
        old_permissions (int): Value of permissions for the request.
        user (Users): Users object that represents the user performing the user_request modification

    Returns:
        Events: The event object representing the change made to the user.

    """

    previous_value = {'user_guid': user_request.user_guid}
    if old_permissions is not None:
        previous_value['permissions'] = old_permissions

    if old_point_of_contact is not None:
        previous_value['point_of_contact'] = old_point_of_contact

    return Events(
        user_request.request_id,
        user.guid,
        events_type,
        previous_value=previous_value,
        new_value=user_request.val_for_events,
        timestamp=datetime.utcnow(),
    )
Esempio n. 10
0
def create_event():

    form = EventForm()
    form.artistName.choices = [(artist1.id, artist1.name)
                               for artist1 in Artist.query.all()]
    form.venueName.choices = [(venue.id, venue.location)
                              for venue in Venues.query.all()]

    if form.validate_on_submit():

        venue = Venues.query.filter_by(id=form.venueName.data).first()
        names = form.artistName.data
        flash('Venue = {}'.format(venue))

        nameList = []
        for i in range(len(names)):
            nameList.append(names[i])
            flash(' Name List{}'.format(nameList[i]))

        event1 = Events(name=form.eventName.data,
                        price='S400',
                        venue_id=venue.id,
                        event_date=form.eventDate.data)
        db.session.add(event1)
        db.session.commit()
        for a in range(len(nameList)):

            value = nameList[a]
            a2e = ArtistToEvent(Artist_id=value, Event_id=event1.id)
            db.session.add(a2e)

    db.session.commit()
    return render_template('create_event.html', form=form)
Esempio n. 11
0
def create_event_post(event_date, event_location, event_leader, start_time,
                      end_time, sponsor, author, title, content, tags):
    """
    Util function for creating a EventPost object. Function will take parameters passed in from the form
    and create a event post along with the event object.
    """
    event_post = EventPosts(event_date=event_date,
                            event_location=event_location,
                            event_leader=event_leader,
                            start_time=start_time,
                            end_time=end_time,
                            sponsor=sponsor,
                            author=author,
                            title=title,
                            content=content,
                            tags=tags)
    create_object(event_post)

    # Create event_post_created Event
    event = Events(post_id=event_post.id,
                   user_id=author,
                   type="event_post_created",
                   previous_value={},
                   new_value=event_post.val_for_events)
    create_object(event)

    return event_post.id
Esempio n. 12
0
def update_status(suborder: Suborders, comment: str, new_status: str):
    """Updates the status of a row from the Suborders table.

    Args:
        suborder: A Suborders instance.
        comment: Any additional information about the updating of the status.
        new_status: The value of the status to be updated to.
    """
    prev_event = Events.query.filter(
        Events.suborder_number == suborder.id,
        Events.new_value['status'].astext == suborder.status).order_by(
            Events.timestamp.desc()).first()

    previous_value = {}
    new_value = {}

    previous_value['status'] = suborder.status
    if prev_event is not None and 'comment' in prev_event.new_value:
        previous_value['comment'] = prev_event.new_value['comment']

    update_object({'status': new_status}, Suborders, suborder.id)

    new_value['status'] = new_status
    if comment:
        new_value['comment'] = comment

    event = Events(suborder.id, event_type.UPDATE_STATUS, current_user.email,
                   previous_value, new_value)
    create_object(event)
    suborder.es_update()
Esempio n. 13
0
def remove_point_of_contact(request_id):
    """
    Remove the current point of contact from a given request
    :param request_id: FOIL request ID
    """
    point_of_contact = get_current_point_of_contact(request_id)
    set_point_of_contact(request_id, point_of_contact, False)
    create_object(
        Events(
            request_id,
            current_user.guid,
            current_user.auth_user_type,
            event_type.REQ_POINT_OF_CONTACT_REMOVED,
            previous_value={
                "user_guid": point_of_contact.user_guid,
                "auth_user_type": point_of_contact.auth_user_type,
                "point_of_contact": "True"
            },
            new_value={
                "user_guid": point_of_contact.user_guid,
                "auth_user_type": point_of_contact.auth_user_type,
                "point_of_contact": "False"
            },
            timestamp=datetime.utcnow(),
        ))
Esempio n. 14
0
def _create_agency_user_requests(request_id, agency_admins, guid_for_event):
    """
    Creates user_requests entries for agency administrators.
    :param request_id: Request being created
    :param agency_users: List of Users
    :param guid_for_event: guid used to create request events
    :return:
    """

    for admin in agency_admins:
        user_request = UserRequests(
            user_guid=admin.guid,
            request_user_type=user_type_request.AGENCY,
            request_id=request_id,
            permissions=Roles.query.filter_by(
                name=role.AGENCY_ADMIN).first().permissions)
        create_object(user_request)
        create_object(
            Events(request_id,
                   guid_for_event,
                   event_type.USER_ADDED,
                   previous_value=None,
                   new_value=user_request.val_for_events,
                   response_id=None,
                   timestamp=datetime.utcnow()))
Esempio n. 15
0
def create_document(uploader_id, file_title, file_name, document_type,
                    file_type, file_path, division):
    """
    Util function to create a Document object and 'document_uploaded' Event
    :param uploader_id: Id of the user who uploaded the file
    :param file_title: Human readable version of the file name
    :param file_name: Actual file name
    :param document_type: Category of document
    :param file_type: Extension of the file
    :param file_path: Full path of where the file is saved on the server
    :param division: Division that the file relates to
    """
    # Create Document object
    document = Documents(uploader_id=uploader_id,
                         file_title=file_title,
                         file_name=file_name,
                         document_type=document_type,
                         file_type=file_type,
                         file_path=file_path,
                         division=division)
    create_object(document)

    # Create document_uploaded Event
    event = Events(document_id=document.id,
                   user_id=uploader_id,
                   type="document_uploaded",
                   previous_value={},
                   new_value=document.val_for_events)
    create_object(event)
Esempio n. 16
0
    def setUp(self):
        self.user = Users
        self.password = self.user.hash_password('password')
        self.new_user = self.user('John', 'Doe', '*****@*****.**',
                                  self.password)

        self.new_event = Events("Barbecue party", "nairobi", "Food",
                                "12/12/2017", 'frank')
Esempio n. 17
0
    def post(self, user_id):
        """Handle POST request for this view. Url ---> /api/events"""

        user = User.query.filter_by(id=user_id).first()  # get user details
        if user.email_confirmed is not True:
            response = {
                "message":
                'Your Must Confirm your Email Address in-order to create an event'
            }
            return make_response(jsonify(response)), 401

        args = {}
        event_models = [
            'title', 'location', 'time', 'date', 'description', 'image_url',
            'event_category'
        ]

        for event_res in event_models:
            var = str(request.data.get(event_res, '').capitalize())
            var = var.strip(' \t\n\r')
            if not var:
                response = {"message": '{} missing'.format(event_res)}
                return make_response(jsonify(response)), 401
            args.update({event_res: var})

        if Events.query.filter_by(title=args['title']).first():
            response = {"message": 'Event title exists. Choose another one'}
            return make_response(jsonify(response)), 401

        event = Events(**args, created_by=user_id)

        event.save()
        response = jsonify({
            'id': event.id,
            'title': event.title,
            'location': event.location,
            'time': event.time,
            'date': event.date,
            'description': event.description,
            'image_url': event.image_url,
            'created_by': user.name,
            'event_category': event.event_category,
        })

        return make_response(response), 201
Esempio n. 18
0
def reset_db():
    flash(
        "Resetting database: deleting old data and repopulating with dummy data"
    )

    meta = db.metadata
    for table in reversed(meta.sorted_tables):
        print('Clear table {}'.format(table))
        db.session.execute(table.delete())
    db.session.commit()

    artist1 = Artist(name="Drake", description="Soon to be added")
    artist2 = Artist(name='Kendrick Lamar', description="Added after Drake")

    venue1 = Venues(location='Baltimore Soundstage, Maryland',
                    date='01/24/2018')
    venue2 = Venues(location='The 20th Century Theater, Ohio',
                    date='04/28/2018')
    venue3 = Venues(location='The New Parish, California', date='04/29/2018')
    event1 = Events(name='Aubrey & The Three Migos ',
                    price='$350',
                    venue_id=1,
                    event_date=datetime.utcnow())
    event2 = Events(name='Leeds Festival 2018',
                    price='$170',
                    venue_id=2,
                    event_date=datetime.utcnow())
    a2e = ArtistToEvent(Artist_id=1, Event_id=1)
    a2e1 = ArtistToEvent(Artist_id=2, Event_id=2)

    db.session.add(artist1)
    db.session.add(artist2)

    db.session.add(venue1)
    db.session.add(venue2)
    db.session.add(venue3)
    db.session.add(event1)
    db.session.add(event2)
    db.session.add(a2e)
    db.session.add(a2e1)

    db.session.commit()

    return redirect(url_for('index'))
Esempio n. 19
0
def addEvent():
    body = json.loads(request.data.decode())
    try:
        if "type" in body:
            event = Events(subject=body['subject'],
                           type=body.get('type'),
                           message=body['message'])
        else:
            event = Events(subject=body['subject'], message=body['message'])
        db.session.add(event)
        db.session.commit()
    except Exception as e:
        print('DB Error: ', e)
        rsp = Response("Error on event registration",
                       status=401,
                       content_type="text/plain")
        return rsp

    print(event)
    rsp = Response("Event registered", status=200, content_type="text/plain")
    return rsp
Esempio n. 20
0
def create_request_info_event(request_id, type_, previous_value, new_value):
    """
    Create and store events object for updating the request information into database.
    :param request_id: request ID
    :param type_: event type
    :param previous_value: previous value
    :param new_value: new value
    """
    event = Events(request_id=request_id,
                   user_guid=current_user.guid,
                   type_=type_,
                   previous_value=previous_value,
                   new_value=new_value)
    create_object(event)
Esempio n. 21
0
def create_event():
    """ Event create view """
    form = CreateEventForm(request.form)
    if request.method == 'POST' and form.validate():
        try:
            format_string = '%Y-%m-%dT%H:%M'
            name = str(request.form['name'])
            year = int(request.form['year'])
            semester = Semester(int(request.form['semester']))
            specialslot = int(request.form['special_slots'])
            specialslotname = str(request.form['special_slots_name'])
            specialslotdescription = str(
                request.form['special_slots_description'])
            timestamp = datetime.now()
            opensignuptimestamp = datetime.strptime(
                str(request.form['open_signup_timestamp']), format_string)
            closesignuptimestamp = datetime.strptime(
                str(request.form['close_signup_timestamp']), format_string)
            place = str(request.form['place'])
            participationfee = str(request.form['participation_fee'])
            signup_open = False
            active = False

        except Exception as e:
            print(e)
            return render_template('error.html',
                                   message=str(
                                       request.form['opensignuptimestamp']))

        try:
            event = Events(name=name,
                           year=year,
                           special_slots=specialslot,
                           special_slots_name=specialslotname,
                           special_slots_description=specialslotdescription,
                           place=place,
                           semester=semester,
                           creation_timestamp=timestamp,
                           signup_open=signup_open,
                           active=active,
                           participation_fee=participationfee,
                           open_signup_timestamp=opensignuptimestamp,
                           close_signup_timestamp=closesignuptimestamp)
            db.session.add(event)
            db.session.commit()
        except Exception as e:
            print(e)
            return render_template('error.html')
        return redirect(url_for('admin'))
    return render_template('create_event.html', form=form)
Esempio n. 22
0
def search():
    """search events given an event name"""
    #get the name given
    name = request.args.get('q')
    #get the given page and number of events or set them to default
    page = request.args.get("page", default=1, type=int)
    per_page = request.args.get("limit", default=15, type=int)
    if name:
        found_events = Events.get_events_by_name(name, page, per_page)
    if found_events.items:
        event_list = make_event_list(found_events.items)
        return jsonify(event_list), 200
    return jsonify({"message" : "there are no more events matching the given name"}), 404
    return jsonify({"message" : "can not search events, provide event name"}), 400
Esempio n. 23
0
def import_test_data(db):
    with open('./test_data.csv', newline='') as csvfile:
        spamreader = csv.reader(csvfile, delimiter=';')
        header = True
        for row in spamreader:
            if header:
                header = False
                continue
            new_event = Events(asin=row[0],
                               brand=row[1],
                               id=row[2],
                               source=row[3],
                               stars=int(row[4]),
                               timestamp=datetime.datetime.fromtimestamp(
                                   int(row[5])))
            db.session.add(new_event)
    db.session.commit()
Esempio n. 24
0
def create_news(author, title, content, tags):
    """
    Util function for creating a News object. Function will take parameters passed in from the form
    and create a News along with the event object.
    """
    news = News(author=author, title=title, content=content, tags=tags)
    create_object(news)

    # Create news_created Event
    event = Events(post_id=news.id,
                   user_id=author,
                   type="news_created",
                   previous_value={},
                   new_value=news.val_for_events)
    create_object(event)

    return news.id
Esempio n. 25
0
def create_user_request_event(events_type, user_request, old_permissions=None):
    """
    Create an Event for the addition, removal, or updating of a UserRequest

    """
    if old_permissions is not None:
        previous_value = {"permissions": old_permissions}
    else:
        previous_value = None
    create_object(
        Events(
            user_request.request_id,
            current_user.guid,
            current_user.auth_user_type,
            events_type,
            previous_value=previous_value,
            new_value=user_request.val_for_events,
            timestamp=datetime.utcnow(),
        ))
Esempio n. 26
0
def create_auth_event(auth_event_type: str, user_guid: str, new_value: dict):
    """
    Create and store event object for given response.

    Args:
        auth_event_type (str): one of app.constants.event_type
        user_guid (Users): Users object performing the authentication event
        new_value (dict): Value to be stored in events table

    """
    event = Events(request_id=None,
                   user_guid=user_guid,
                   type_=auth_event_type,
                   timestamp=datetime.utcnow(),
                   response_id=None,
                   previous_value=None,
                   new_value=new_value)
    # store event object
    create_object(event)
Esempio n. 27
0
 def post(self):
     current_user = get_jwt_identity()
     data = request.get_json()
     if not data:
         return invalid_data, 400
     name = data["name"]
     desc = data["description"]
     location = data["location"]
     date = data["event_date"]
     event = Events.query.filter_by(name=name, user_id=current_user).first()
     if event:
         return {"error": "event exists"}, 409
     post_event = Events(name=name,
                         desc=desc,
                         location=location,
                         event_date=date,
                         owner=current_user)
     db.session.add(post_event)
     db.session.commit()
     return {"message": "{} has been added".format(name)}, 201
Esempio n. 28
0
def edit_events():
    form = EventsForm()
    events = Events.query.all()
    if form.validate_on_submit():
        event = Events(Events_title=form.Events_title.data, Events_time=form.Events_time.data,
                       Events_city=form.Events_city.data,
                       Events_country=form.Events_country.data, Events_intro=form.Events_intro.data)
        db.session.add(event)
        db.session.commit()
        flash(_('Added'))
        return redirect(url_for('main.edit_events'))
    if request.method == 'POST':
        del_form = request.form
        for ID in del_form.to_dict():
            record_id = ID
        del_event = Events.query.filter_by(id=record_id).first()
        db.session.delete(del_event)
        db.session.commit()
        flash(_('Deleted'))
        return redirect(url_for('main.edit_events'))
    return render_template("edit_database/EditEvents.html", form=form, events=events)
Esempio n. 29
0
def rsvp(event_id):
    """register a user to an event"""
    event = Events.get_event_by_id(event_id)
    if event:
        if request.method == 'POST':
            res = event.add_rsvp(g.user)
            if res == "rsvp success":
                return jsonify({"message" : "rsvp success, see you then"}), 201
            return jsonify({"message" : "already registered for this event"}), 302
        rsvps = event.rsvps.all()
        if rsvps:
            rsvp_list = []
            for user in rsvps:
                rsvp= {
                    "username" : user.username,
                    "email" : user.email
                }
                rsvp_list.append(rsvp)
            return jsonify(rsvp_list), 200
        return jsonify({"message" : "no users have responded to this event yet"}),200
    return jsonify({"message" : "event does not exist"}), 404
Esempio n. 30
0
def patch(agency_ein):
    """
    Only accessible by Super Users

    Currently only changes:
        is_active
    """
    if not current_user.is_anonymous and current_user.is_super:
        is_active = request.form.get('is_active')
        if is_active is not None and Agencies.query.filter_by(
                ein=agency_ein).first() is not None:
            update_object({'is_active': eval_request_bool(is_active)},
                          Agencies, agency_ein)
            create_object(
                Events(request_id=None,
                       user_guid=current_user.guid,
                       auth_user_type=current_user.auth_user_type,
                       type_=AGENCY_ACTIVATED,
                       new_value={"ein": agency_ein},
                       timestamp=datetime.utcnow()))
            return '', 200
        return '', 400
    return '', 403
Esempio n. 31
0
def create_meeting_notes(meeting_date, meeting_location, meeting_leader,
                         meeting_note_taker, start_time, end_time, attendees,
                         next_meeting_date, next_meeting_leader,
                         next_meeting_note_taker, meeting_type, division,
                         author, title, content, tags):
    """
    Util function for creating a MeetingNotes object. Function will take parameters passed in from the form
    and create a meeting notes along with the event object.
    """
    meeting_notes = MeetingNotes(
        meeting_date=meeting_date,
        meeting_location=meeting_location,
        meeting_leader=meeting_leader,
        meeting_note_taker=meeting_note_taker,
        start_time=start_time,
        end_time=end_time,
        attendees=attendees,
        next_meeting_date=next_meeting_date or None,
        next_meeting_leader=next_meeting_leader or None,
        next_meeting_note_taker=next_meeting_note_taker or None,
        meeting_type=meeting_type,
        division=division,
        author=author,
        title=title,
        content=content,
        tags=tags)
    create_object(meeting_notes)

    # Create meeting_notes_created Event
    event = Events(post_id=meeting_notes.id,
                   user_id=author,
                   type="meeting_notes_created",
                   previous_value={},
                   new_value=meeting_notes.val_for_events)
    create_object(event)

    return meeting_notes.id