Пример #1
0
def modify_meeting(meeting_id):
    try:
        name, where, location_lat, location_lng, when, when_end, available, quota = get_meeting_data_from_request(
        )
    except ValueError:
        return render_template('error.html',
                               current_user=get_current_user(),
                               message='잘못된 요청입니다.'), 400

    meeting = db_session.query(Meeting).filter(
        Meeting.id == meeting_id).first()
    if not meeting:
        return render_template('error.html',
                               current_user=get_current_user(),
                               message='해당 모임 정보가 없습니다.')

    when = config.TIMEZONE.localize(datetime.strptime(when, '%Y-%m-%d %H:%M'))
    when_end = config.TIMEZONE.localize(
        datetime.strptime(when_end, '%Y-%m-%d %H:%M'))

    meeting.name = name
    meeting.where = where
    meeting.location_lat = location_lat
    meeting.location_lng = location_lng
    meeting.when = when
    meeting.when_end = when_end
    meeting.available = available
    meeting.quota = quota
    db_session.add(meeting)
    db_session.commit()

    return redirect(url_for('meetings.get_meetings'))
Пример #2
0
def form_modify_meeting(meeting_id):
    meeting = db_session.query(Meeting).filter(
        Meeting.id == meeting_id).first()
    if not meeting:
        return render_template('error.html',
                               current_user=get_current_user(),
                               message='해당 모임 정보가 없습니다.')
    return render_template('form-meeting.html',
                           meeting=meeting,
                           current_user=get_current_user(),
                           config=config)
Пример #3
0
def get_form_registration(meeting_id):
    message = request.args.get('message', None)
    current_user = get_current_user()
    meeting = db_session.query(Meeting).filter(Meeting.id == meeting_id).first()
    registration = db_session.query(Registration).filter(Registration.user == current_user, Registration.meeting == meeting).first()

    if (not meeting or len(meeting.users) >= meeting.quota or not meeting.available) and not registration:
        return render_template('meeting.html', message='이미 끝난 모임이거나, 정원이 다 차버린 모임입니다.', meeting=meeting,
                               current_user=get_current_user())

    return render_template('registration.html', participant=current_user, current_user=current_user, next_meeting=meeting,
                           message=message, registration=registration)
Пример #4
0
def post_registration(meeting_id):
    participant = get_current_user()
    memo = request.form.get('memo', None)

    if not memo:
        return redirect(
            url_for('meetings.get_form_registration',
                    meeting_id=meeting_id,
                    message='모임에서 달성할 목표는 반드시 입력해야합니다.'))

    meeting = db_session.query(Meeting).filter(
        Meeting.id == meeting_id).first()
    if not meeting:
        return redirect(
            url_for('meetings.get_form_registration',
                    meeting_id=meeting_id,
                    message='해당 모임이 존재하지 않습니다.'))

    registration = db_session.query(Registration).filter(
        Registration.user == participant,
        Registration.meeting == meeting).first()
    if not registration:
        if not meeting.available or len(meeting.users) >= meeting.quota:
            return redirect(
                url_for('meetings.get_form_registration',
                        meeting_id=meeting_id,
                        message='해당 모임에는 참가할 수 없습니다.'))
        registration = Registration(user_id=participant.id,
                                    meeting_id=meeting_id)

    registration.memo = memo
    db_session.add(registration)
    db_session.commit()

    return redirect(url_for('meetings.get_meeting', meeting_id=meeting_id))
Пример #5
0
def post_meeting():
    try:
        name, where, location_lat, location_lng, when, when_end, available, quota = get_meeting_data_from_request(
        )
    except ValueError:
        return render_template('error.html',
                               current_user=get_current_user(),
                               message='잘못된 요청입니다.'), 400

    when = config.TIMEZONE.localize(datetime.strptime(when, '%Y-%m-%d %H:%M'))
    when_end = config.TIMEZONE.localize(
        datetime.strptime(when_end, '%Y-%m-%d %H:%M'))

    meeting = Meeting(name=name,
                      where=where,
                      when=when,
                      when_end=when_end,
                      available=available,
                      quota=quota,
                      location_lat=location_lat,
                      location_lng=location_lng)
    db_session.add(meeting)
    db_session.commit()

    return redirect(url_for('meetings.get_meetings'))
Пример #6
0
def get_signin():
    message = request.args.get('message', None)
    dest = request.args.get('dest', None)
    return render_template('signin.html',
                           dest=dest,
                           message=message,
                           current_user=get_current_user())
Пример #7
0
def get_meeting(meeting_id):
    meeting = db_session.query(Meeting).filter(
        Meeting.id == meeting_id).first()
    return render_template('meeting.html',
                           meeting=meeting,
                           current_user=get_current_user(),
                           config=config)
Пример #8
0
def get_form_registration(meeting_id):
    message = request.args.get('message', None)
    current_user = get_current_user()
    meeting = db_session.query(Meeting).filter(
        Meeting.id == meeting_id).first()
    registration = db_session.query(Registration).filter(
        Registration.user == current_user,
        Registration.meeting == meeting).first()

    if (not meeting or len(meeting.users) >= meeting.quota
            or not meeting.available) and not registration:
        return render_template('meeting.html',
                               message='이미 끝난 모임이거나, 정원이 다 차버린 모임입니다.',
                               meeting=meeting,
                               current_user=get_current_user())

    return render_template('registration.html',
                           participant=current_user,
                           current_user=current_user,
                           next_meeting=meeting,
                           message=message,
                           registration=registration)
Пример #9
0
def modify_meeting(meeting_id):
    try:
        name, where, location_lat, location_lng, when, available, quota = get_meeting_data_from_request()
    except ValueError:
        return render_template('error.html', current_user=get_current_user(), message='잘못된 요청입니다.'), 400

    meeting = db_session.query(Meeting).filter(Meeting.id == meeting_id).first()
    if not meeting:
        return render_template('error.html', current_user=get_current_user(), message='해당 모임 정보가 없습니다.')

    when = config.TIMEZONE.localize(datetime.strptime(when, '%Y-%m-%d %H:%M'))

    meeting.name = name
    meeting.where = where
    meeting.location_lat = location_lat
    meeting.location_lng = location_lng
    meeting.when = when
    meeting.available = available
    meeting.quota = quota
    db_session.add(meeting)
    db_session.commit()

    return redirect(url_for('meetings.get_meetings'))
Пример #10
0
def post_meeting():
    try:
        name, where, location_lat, location_lng, when, available, quota = get_meeting_data_from_request()
    except ValueError:
        return render_template('error.html', current_user=get_current_user(), message='잘못된 요청입니다.'), 400

    when = config.TIMEZONE.localize(datetime.strptime(when, '%Y-%m-%d %H:%M'))

    meeting = Meeting(
        name=name, where=where, when=when, available=available, quota=quota, location_lat=location_lat,
        location_lng=location_lng)
    db_session.add(meeting)
    db_session.commit()

    return redirect(url_for('meetings.get_meetings'))
Пример #11
0
def post_slides(meeting_id):
    presenter_id = int(request.form.get('presenter_id', '-1'))
    title = request.form.get('title', None)
    memo = request.form.get('memo', None)
    url = request.form.get('url', None)

    if not title or not url or presenter_id == -1:
        return render_template(
            'form-slides.html', current_user=get_current_user(), meeting_id=meeting_id,
            message='발표자 번호, 제목, URL은 반드시 입력해야합니다.')

    slide = Slide(presenter_id=presenter_id, meeting_id=meeting_id, title=title, memo=memo, url=url)
    db_session.add(slide)
    db_session.commit()

    return redirect(url_for('meetings.get_meeting', meeting_id=meeting_id))
Пример #12
0
def post_slides(meeting_id):
    presenter_id = int(request.form.get('presenter_id', '-1'))
    title = request.form.get('title', None)
    memo = request.form.get('memo', None)
    url = request.form.get('url', None)

    if not title or not url or presenter_id == -1:
        return render_template('form-slides.html',
                               current_user=get_current_user(),
                               meeting_id=meeting_id,
                               message='발표자 번호, 제목, URL은 반드시 입력해야합니다.')

    slide = Slide(presenter_id=presenter_id,
                  meeting_id=meeting_id,
                  title=title,
                  memo=memo,
                  url=url)
    db_session.add(slide)
    db_session.commit()

    return redirect(url_for('meetings.get_meeting', meeting_id=meeting_id))
Пример #13
0
def post_registration(meeting_id):
    participant = get_current_user()
    memo = request.form.get('memo', None)

    if not memo:
        return redirect(url_for('meetings.get_form_registration', meeting_id=meeting_id, message='모임에서 달성할 목표는 반드시 입력해야합니다.'))

    meeting = db_session.query(Meeting).filter(Meeting.id == meeting_id).first()
    if not meeting:
        return redirect(url_for('meetings.get_form_registration', meeting_id=meeting_id, message='해당 모임이 존재하지 않습니다.'))

    registration = db_session.query(Registration).filter(Registration.user == participant, Registration.meeting == meeting).first()
    if not registration:
        if not meeting.available or len(meeting.users) >= meeting.quota:
            return redirect(url_for('meetings.get_form_registration', meeting_id=meeting_id, message='해당 모임에는 참가할 수 없습니다.'))
        registration = Registration(user_id=participant.id, meeting_id=meeting_id)

    registration.memo = memo
    db_session.add(registration)
    db_session.commit()

    return redirect(url_for('meetings.get_meeting', meeting_id=meeting_id))
Пример #14
0
def get_meeting(meeting_id):
    meeting = db_session.query(Meeting).filter(Meeting.id == meeting_id).first()
    return render_template('meeting.html', meeting=meeting, current_user=get_current_user())
Пример #15
0
def get_form_meeting():
    return render_template('add-meeting.html', current_user=get_current_user())
Пример #16
0
def form_modify_meeting(meeting_id):
    meeting = db_session.query(Meeting).filter(Meeting.id == meeting_id).first()
    if not meeting:
        return render_template('error.html', current_user=get_current_user(), message='해당 모임 정보가 없습니다.')
    return render_template('form-meeting.html', meeting=meeting, current_user=get_current_user(), config=config)
Пример #17
0
def get_meetings():
    meetings = db_session.query(Meeting).order_by(desc(Meeting.registered)).all()
    return render_template('meetings-list.html', meetings=meetings, current_user=get_current_user())
Пример #18
0
def get_index():
    meeting_count = db_session.query(Meeting).filter(Meeting.when < datetime.now(tz=config.TIMEZONE)).count()
    next_meeting = db_session.query(Meeting).filter(Meeting.available).order_by(desc(Meeting.registered)).first()
    return render_template('index.html', meeting_count=meeting_count, current_user=get_current_user(), next_meeting=next_meeting)
Пример #19
0
def get_form_meeting():
    return render_template('form-meeting.html', current_user=get_current_user(), config=config)
Пример #20
0
def get_form_meeting():
    return render_template('form-meeting.html',
                           current_user=get_current_user(),
                           config=config)
Пример #21
0
def get_meetings():
    meetings = db_session.query(Meeting).order_by(desc(
        Meeting.registered)).all()
    return render_template('meetings-list.html',
                           meetings=meetings,
                           current_user=get_current_user())
Пример #22
0
def form_post_slide(meeting_id):
    return render_template('form-slides.html', meeting_id=meeting_id, current_user=get_current_user())
Пример #23
0
def get_signin():
    message = request.args.get('message', None)
    dest = request.args.get('dest', None)
    return render_template('signin.html', dest=dest, message=message, current_user=get_current_user())
Пример #24
0
def form_post_slide(meeting_id):
    return render_template('form-slides.html',
                           meeting_id=meeting_id,
                           current_user=get_current_user())