コード例 #1
0
ファイル: views.py プロジェクト: hoffrenm/tapahtumakalenteri
def admin_show(event_id):
    event = Event.query.get(event_id)
    comments = Comment.find_comments_for_event(event_id)
    participants = Event.find_participants_for_event(event_id)

    return render_template("events/details.html",
                           event=event,
                           comments=comments,
                           participants=participants)
コード例 #2
0
ファイル: views.py プロジェクト: hoffrenm/tapahtumakalenteri
def event_show(event_id):
    event = Event.query.get(event_id)
    comments = Comment.find_comments_for_event(event_id)
    attendees = Event.participant_count(event_id)
    account = User.query.get(current_user.id)

    # format dateinfo for template
    event.day = datetime.strftime(event.date_time, '%d.')
    event.month = datetime.strftime(event.date_time, '%B')
    event.time = datetime.strftime(event.date_time, '%H:%M')
    event.date = datetime.strftime(event.date_time, '%d.%m.%Y')

    if event in account.attending:
        userHasjoined = True
    else:
        userHasjoined = False

    return render_template("events/event.html",
                           event=event,
                           attendees=attendees,
                           comments=comments,
                           form=CommentForm(),
                           userHasjoined=userHasjoined)