Ejemplo n.º 1
0
def show_microblog(page):
    pagination = Microblog.query.order_by(Microblog.post_time.desc()).\
        paginate(page, per_page=50)
    microblogs = pagination.items
    return render_template('admin/microblog.html',
                           microblogs=microblogs,
                           pagination=pagination)
Ejemplo n.º 2
0
def album(id):
    people = People.query.get_or_404(id)
    # albums = PhotoAlbum.query.filter_by(people_id=id).all()
    # default_album_photos = Photo.query.filter_by(people_id=id).all()
    return render_template('photo/all-albums.html',
                           people=people,
                           title='所有相册')
Ejemplo n.º 3
0
def login():
    # 已登录用户则返回首页
    if g.user.is_authenticated:
        return redirect(url_for('frontend.index'))

    login_form = LoginForm()
    if login_form.validate_on_submit():
        people = People.query.authenticate(
            login_form.login.data,
            login_form.password.data,
        )

        if people:
            login_user(people, remember=login_form.remember.data)
            # Flask-Principal 发送信号
            identity_changed.send(current_app._get_current_object(),
                                  identity=Identity(people.id))
            print 'sent by login'
            ip = get_client_ip()
            login_log = LoginLog(people.id, ip)
            db.session.add(login_log)
            db.session.commit()

            flash('登录成功', 'success')
            return redirect(url_for('frontend.index'))
        else:
            flash('登录失败', 'warning')

    return render_template('login.html', form=login_form)
Ejemplo n.º 4
0
def login():
    # 已登录用户则返回首页
    if g.user.is_authenticated:
        return redirect(url_for('frontend.index'))

    login_form = LoginForm()
    if login_form.validate_on_submit():
        people = People.query.authenticate(
            login_form.login.data,
            login_form.password.data,
        )

        if people:
            login_user(people, remember=login_form.remember.data)
            # Flask-Principal 发送信号
            identity_changed.send(current_app._get_current_object(), identity=Identity(people.id))
            print 'sent by login'
            ip = get_client_ip()
            login_log = LoginLog(people.id, ip)
            db.session.add(login_log)
            db.session.commit()

            flash('登录成功', 'success')
            return redirect(url_for('frontend.index'))
        else:
            flash('登录失败', 'warning')

    return render_template('login.html', form=login_form)
Ejemplo n.º 5
0
def avatar():
    avatar_form = AvatarForm()
    if avatar_form.validate_on_submit():
        if avatar_form.avatar.data:
            # 上传头像
            avatar_filename = g.user.get_avatar_uri()
            avatar_data = request.files[avatar_form.avatar.name]
            uploader = get_uploader()
            avatar_filename = uploader.save(avatar_data)
            if not avatar_filename:
                flash('上传失败', 'danger')
                return redirect(url_for('account.avatar'))
            # url = photos.url(avatar_filename)
            # print url
            # old_avatar = photos.url(people.avatar)
            # os.remove(old_avatar)   # 删除旧头像
            print avatar_filename
            g.user.change_avatar(avatar_filename)
            db.session.add(g.user)
            db.session.commit()
            flash('上传成功', 'success')
            return redirect(url_for('account.avatar'))

    return render_template('avatar.html',
                           avatar_form=avatar_form,
                           title='修改头像')
Ejemplo n.º 6
0
def show_login_log(page):
    pagination = LoginLog.query.order_by(LoginLog.login_time.desc()).\
        paginate(page, per_page=50)
    login_logs = pagination.items
    return render_template('admin/login-log.html',
                           login_logs=login_logs,
                           pagination=pagination)
Ejemplo n.º 7
0
def show_people(page):
    pagination = People.query.paginate(page, per_page=50)
    people = pagination.items
    return render_template(
        'admin/people.html',
        people=people,
        pagination=pagination
    )
Ejemplo n.º 8
0
def show_login_log(page):
    pagination = LoginLog.query.order_by(LoginLog.login_time.desc()).\
        paginate(page, per_page=50)
    login_logs = pagination.items
    return render_template(
        'admin/login-log.html',
        login_logs=login_logs,
        pagination=pagination
    )
Ejemplo n.º 9
0
def post():
    post_form = PostForm()
    if post_form.validate_on_submit():
        microblog = Microblog(g.user.id, post_form.content.data)
        db.session.add(microblog)
        db.session.commit()
        flash('发布成功', 'success')
        return redirect(url_for('frontend.index'))
    return render_template('post.html', form=post_form)
Ejemplo n.º 10
0
def show_visit_log(page):
    pagination = VisitLog.query.order_by(VisitLog.visit_time.desc()).\
        paginate(page, per_page=50)
    # For BAE f*****g MySQL
    # pagination = VisitLog.query.paginate(page, per_page=50)
    visit_logs = pagination.items
    return render_template('admin/visit-log.html',
                           visit_logs=visit_logs,
                           pagination=pagination)
Ejemplo n.º 11
0
def post():
    post_form = PostForm()
    if post_form.validate_on_submit():
        microblog = Microblog(g.user.id, post_form.content.data)
        db.session.add(microblog)
        db.session.commit()
        flash('发布成功', 'success')
        return redirect(url_for('frontend.index'))
    return render_template('post.html', form=post_form)
Ejemplo n.º 12
0
def show_microblog(page):
    pagination = Microblog.query.order_by(Microblog.post_time.desc()).\
        paginate(page, per_page=50)
    microblogs = pagination.items
    return render_template(
        'admin/microblog.html',
        microblogs=microblogs,
        pagination=pagination
    )
Ejemplo n.º 13
0
def show_album(id):
    """显示相册里的所有照片,只能查看自己的相册"""
    album = PhotoAlbum.query.get_or_404(id)
    #if album.people_id != g.user.id:
    #    flash('权限不足', 'warning')
    #    return redirect(url_for('frontend.index'))
    return render_template(
        'photo/album.html',
        album=album,
        title='查看相册'
    )
Ejemplo n.º 14
0
def show_visit_log(page):
    pagination = VisitLog.query.order_by(VisitLog.visit_time.desc()).\
        paginate(page, per_page=50)
    # For BAE f*****g MySQL
    # pagination = VisitLog.query.paginate(page, per_page=50)
    visit_logs = pagination.items
    return render_template(
        'admin/visit-log.html',
        visit_logs=visit_logs,
        pagination=pagination
    )
Ejemplo n.º 15
0
def upload_photo(id=None):
    if id:
        album = PhotoAlbum.query.get_or_404(id)
        if album.people_id != g.user.id:
            flash('权限不足', 'warning')
            return redirect('frontend.index')
    # 列出所有相册
    album_choices = [(str(a.id), a.title) for a in g.user.albums]
    if not album_choices:
        # 如果没有任何相册,则新建一个默认相册
        default_album = PhotoAlbum(
            title='默认相册',
            people_id=g.user.id
        )
        db.session.add(default_album)
        db.session.commit()
        album_choices.append((str(default_album.id), default_album.title))
        
    upload_form = UploadForm()
    upload_form.album.choices = album_choices
    if not id:
        id = album_choices[0][0]    # 第一个相册的 id
    upload_form.album.data = str(id)
    
    if upload_form.validate_on_submit():
        print 'id:', upload_form.album.data
        album = PhotoAlbum.query.get_or_404(upload_form.album.data)
        if album.people_id != g.user.id:
            flash('权限不足', 'warning')
            return redirect('frontend.index')
         # 循环上传照片
        for field in upload_form:
            print field.name
            if 'photo' in field.name and field.data:
                photo_data = request.files[field.name]
                uploader = get_uploader()
                filename = uploader.save(photo_data)
                if not filename:
                    flash('上传失败', 'danger')
                    return redirect(url_for('frontend.album', id=g.user.id))
                print upload_form.album.data
                photo = Photo(uri=filename, album_id=upload_form.album.data, people_id=g.user.id)
                db.session.add(photo)
                db.session.commit()
        flash('上传成功', 'success')
        return redirect(url_for('frontend.album', id=g.user.id))

    return render_template(
        'photo/upload.html',
        form=upload_form,
        title='上传照片'
    )
Ejemplo n.º 16
0
def index():
    if g.user.is_authenticated:
        # 只显示关注的人
        microblogs = Microblog.query.\
            filter(Microblog.people_id.in_([p.id for p in g.user.following]+[g.user.id])).\
            order_by(Microblog.post_time.desc()).all()
    else:
        microblogs = Microblog.query.order_by(
            Microblog.post_time.desc()).limit(10).all()
    # print microblogs
    return render_template('index.html',
                           microblogs=microblogs,
                           post_form=PostForm())
Ejemplo n.º 17
0
def repost(id):
    microblog = Microblog.query.get_or_404(id)
    repost_form = RepostForm()
    if repost_form.validate_on_submit():
        rp_microblog = Microblog(g.user.id, repost_form.content.data, parent_microblog_id=id)
        db.session.add(rp_microblog)
        if g.user.id != microblog.people_id:
            notification = Notification(
                from_id=g.user.id, to_id=microblog.people_id,
                object_table='microblog', object_id=id
            )
            db.session.add(notification)
        db.session.commit()
        flash('转发成功', 'success')
        return redirect(url_for('frontend.index'))
    return render_template('repost.html', form=repost_form, microblog=microblog)
Ejemplo n.º 18
0
def comment(mid, cid=None):
    microblog = Microblog.query.get_or_404(mid)

    # 如果是对评论的评论,则在表单中显示回复的目标(字符串)
    # 并在提交时使用切片运算忽略该字符串
    if cid:
        parent_comment = Comment.query.get_or_404(cid)
        # 不能回复自己
        if g.user.id == parent_comment.people.id:
            flash('不能回复自己', 'warning')
            return redirect(url_for('mblog.comment', mid=mid))
        content = '回复 ' + parent_comment.people.nickname + ': '
    else:
        parent_comment = None
        content = ''
    comment_form = CommentForm(content=content)
    if comment_form.validate_on_submit():
        comment = Comment(
            g.user.id,
            comment_form.content.data[len(content):],
            mid,
            cid
        )
        db.session.add(comment)
        db.session.commit()
        if cid and g.user.id != parent_comment.people_id:
            notification = Notification(
                from_id=g.user.id, to_id=parent_comment.people_id,
                object_table='comment', object_id=comment.id
            )
            db.session.add(notification)
            db.session.commit()
        elif g.user.id != microblog.people_id:
            notification = Notification(
                from_id=g.user.id, to_id=microblog.people_id,
                object_table='microblog', object_id=mid
            )
            db.session.add(notification)
            db.session.commit()
        flash('评论成功', 'success')
        return redirect(url_for('mblog.comment', mid=mid))
    return render_template(
        'comment.html',
        form=comment_form,
        microblog=microblog,
        parent_comment=parent_comment
    )
Ejemplo n.º 19
0
def modify_photo(id):
    photo = Photo.query.get_or_404(id)
    if photo.people_id != g.user.id:
        flash('权限不足', 'warning')
        return redirect(url_for('frontend.index'))
    photo_form = PhotoForm(obj=photo)
    if photo_form.validate_on_submit():
        photo.description = photo_form.description.data
        db.session.add(photo)
        db.session.commit()
        flash('修改成功', 'success')
        return redirect(url_for('show_photo', id=id))
    return render_template(
        'photo/photo-info.html',
        form=photo_form,
        title='修改照片属性'
    )
Ejemplo n.º 20
0
def profile_detail():
    people_info = PeopleInfo.query.get(g.user.id)
    profile_detail_form = ModifyProfileDetailForm(obj=people_info)
    if profile_detail_form.validate_on_submit():
        if people_info:
            people_info.change_info(
                fullname=profile_detail_form.fullname.data,
                gender=profile_detail_form.gender.data,
                sexual_orientation=profile_detail_form.sexual_orientation.data,
                birthday=profile_detail_form.birthday.data,
                blood_type=profile_detail_form.blood_type.data,
                profession=profile_detail_form.profession.data,
                education=profile_detail_form.education.data,
                school=profile_detail_form.school.data,
                homepage=profile_detail_form.homepage.data,
                hometown=profile_detail_form.hometown.data,
                location=profile_detail_form.location.data,
                address=profile_detail_form.address.data,
                zip_code=profile_detail_form.zip_code.data,
                qq=profile_detail_form.qq.data,
                introduction=profile_detail_form.introduction.data)
        else:
            people_info = PeopleInfo(
                id=g.user.id,
                fullname=profile_detail_form.fullname.data,
                gender=profile_detail_form.gender.data,
                sexual_orientation=profile_detail_form.sexual_orientation.data,
                birthday=profile_detail_form.birthday.data,
                blood_type=profile_detail_form.blood_type.data,
                profession=profile_detail_form.profession.data,
                education=profile_detail_form.education.data,
                school=profile_detail_form.school.data,
                homepage=profile_detail_form.homepage.data,
                hometown=profile_detail_form.hometown.data,
                location=profile_detail_form.location.data,
                address=profile_detail_form.address.data,
                zip_code=profile_detail_form.zip_code.data,
                qq=profile_detail_form.qq.data,
                introduction=profile_detail_form.introduction.data)
        db.session.add(people_info)
        db.session.commit()
        flash('详细资料修改成功', 'success')
        return redirect(url_for('account.profile_detail'))
    return render_template('profile-detail.html',
                           form=profile_detail_form,
                           title='详细资料')
Ejemplo n.º 21
0
def password():
    change_password_form = ChangePasswordForm()
    if change_password_form.validate_on_submit():
        people = People.query.authenticate(
            g.user.get_email(),
            change_password_form.password_old.data,
        )
        if people:
            people.change_password(change_password_form.password_new.data)
            db.session.add(people)
            db.session.commit()
            db.session.close()
            flash('密码修改成功', 'success')
            return redirect(url_for('account.password'))
        else:
            flash('原密码不正确', 'warning')
    return render_template('password.html', form=change_password_form, title='修改密码')
Ejemplo n.º 22
0
def profile_detail():
    people_info = PeopleInfo.query.get(g.user.id)
    profile_detail_form = ModifyProfileDetailForm(obj=people_info)
    if profile_detail_form.validate_on_submit():
        if people_info:
            people_info.change_info(
                fullname=profile_detail_form.fullname.data,
                gender=profile_detail_form.gender.data,
                sexual_orientation=profile_detail_form.sexual_orientation.data,
                birthday=profile_detail_form.birthday.data,
                blood_type=profile_detail_form.blood_type.data,
                profession=profile_detail_form.profession.data,
                education=profile_detail_form.education.data,
                school=profile_detail_form.school.data,
                homepage=profile_detail_form.homepage.data,
                hometown=profile_detail_form.hometown.data,
                location=profile_detail_form.location.data,
                address=profile_detail_form.address.data,
                zip_code=profile_detail_form.zip_code.data,
                qq=profile_detail_form.qq.data,
                introduction=profile_detail_form.introduction.data
            )
        else:
            people_info = PeopleInfo(
                id=g.user.id,
                fullname=profile_detail_form.fullname.data,
                gender=profile_detail_form.gender.data,
                sexual_orientation=profile_detail_form.sexual_orientation.data,
                birthday=profile_detail_form.birthday.data,
                blood_type=profile_detail_form.blood_type.data,
                profession=profile_detail_form.profession.data,
                education=profile_detail_form.education.data,
                school=profile_detail_form.school.data,
                homepage=profile_detail_form.homepage.data,
                hometown=profile_detail_form.hometown.data,
                location=profile_detail_form.location.data,
                address=profile_detail_form.address.data,
                zip_code=profile_detail_form.zip_code.data,
                qq=profile_detail_form.qq.data,
                introduction=profile_detail_form.introduction.data
            )
        db.session.add(people_info)
        db.session.commit()
        flash('详细资料修改成功', 'success')
        return redirect(url_for('account.profile_detail'))
    return render_template('profile-detail.html', form=profile_detail_form, title='详细资料')
Ejemplo n.º 23
0
def profile():
    people = g.user
    profile_form = ModifyProfileForm(obj=people)
    if profile_form.validate_on_submit():
        #new_password = profile_form.password.data
        new_nickname = profile_form.nickname.data
        new_mobile = profile_form.mobile.data
        #if new_password:
        #    people.change_password(new_password)
        if new_nickname:
            people.change_nickname(new_nickname)
        if new_mobile:
            people.change_mobile(new_mobile)
        db.session.add(people)
        db.session.commit()
        db.session.close()
        flash('个人资料修改成功', 'success')
        return redirect(url_for('account.profile'))
    return render_template('profile.html', form=profile_form, title='修改资料')
Ejemplo n.º 24
0
def password():
    change_password_form = ChangePasswordForm()
    if change_password_form.validate_on_submit():
        people = People.query.authenticate(
            g.user.get_email(),
            change_password_form.password_old.data,
        )
        if people:
            people.change_password(change_password_form.password_new.data)
            db.session.add(people)
            db.session.commit()
            db.session.close()
            flash('密码修改成功', 'success')
            return redirect(url_for('account.password'))
        else:
            flash('原密码不正确', 'warning')
    return render_template('password.html',
                           form=change_password_form,
                           title='修改密码')
Ejemplo n.º 25
0
def profile():
    people = g.user
    profile_form = ModifyProfileForm(obj=people)
    if profile_form.validate_on_submit():
        #new_password = profile_form.password.data
        new_nickname = profile_form.nickname.data
        new_mobile = profile_form.mobile.data
        #if new_password:
        #    people.change_password(new_password)
        if new_nickname:
            people.change_nickname(new_nickname)
        if new_mobile:
            people.change_mobile(new_mobile)
        db.session.add(people)
        db.session.commit()
        db.session.close()
        flash('个人资料修改成功', 'success')
        return redirect(url_for('account.profile'))
    return render_template('profile.html', form=profile_form, title='修改资料')
Ejemplo n.º 26
0
def repost(id):
    microblog = Microblog.query.get_or_404(id)
    repost_form = RepostForm()
    if repost_form.validate_on_submit():
        rp_microblog = Microblog(g.user.id,
                                 repost_form.content.data,
                                 parent_microblog_id=id)
        db.session.add(rp_microblog)
        if g.user.id != microblog.people_id:
            notification = Notification(from_id=g.user.id,
                                        to_id=microblog.people_id,
                                        object_table='microblog',
                                        object_id=id)
            db.session.add(notification)
        db.session.commit()
        flash('转发成功', 'success')
        return redirect(url_for('frontend.index'))
    return render_template('repost.html',
                           form=repost_form,
                           microblog=microblog)
Ejemplo n.º 27
0
def add_album():
    """新建相册"""
    add_album_form = AddAlbumForm()
    if add_album_form.validate_on_submit():
        album = PhotoAlbum(
            title=add_album_form.title.data,
            description=add_album_form.description.data,
            people_id=g.user.id
        )
        db.session.add(album)
        db.session.commit()
        flash('相册新建成功', 'success')
        return redirect(url_for('show_album', id=album.id))
        # return '添加成功'

    return render_template(
        'photo/album-info.html',
        form=add_album_form,
        title='新建相册'
    )
Ejemplo n.º 28
0
def comment(mid, cid=None):
    microblog = Microblog.query.get_or_404(mid)

    # 如果是对评论的评论,则在表单中显示回复的目标(字符串)
    # 并在提交时使用切片运算忽略该字符串
    if cid:
        parent_comment = Comment.query.get_or_404(cid)
        # 不能回复自己
        if g.user.id == parent_comment.people.id:
            flash('不能回复自己', 'warning')
            return redirect(url_for('mblog.comment', mid=mid))
        content = '回复 ' + parent_comment.people.nickname + ': '
    else:
        parent_comment = None
        content = ''
    comment_form = CommentForm(content=content)
    if comment_form.validate_on_submit():
        comment = Comment(g.user.id, comment_form.content.data[len(content):],
                          mid, cid)
        db.session.add(comment)
        db.session.commit()
        if cid and g.user.id != parent_comment.people_id:
            notification = Notification(from_id=g.user.id,
                                        to_id=parent_comment.people_id,
                                        object_table='comment',
                                        object_id=comment.id)
            db.session.add(notification)
            db.session.commit()
        elif g.user.id != microblog.people_id:
            notification = Notification(from_id=g.user.id,
                                        to_id=microblog.people_id,
                                        object_table='microblog',
                                        object_id=mid)
            db.session.add(notification)
            db.session.commit()
        flash('评论成功', 'success')
        return redirect(url_for('mblog.comment', mid=mid))
    return render_template('comment.html',
                           form=comment_form,
                           microblog=microblog,
                           parent_comment=parent_comment)
Ejemplo n.º 29
0
def show_photo(pid, aid=None):
    photo = Photo.query.get_or_404(pid)
    prev_id = next_id = None
    if aid:
        if photo.album_id != aid:
            abort(404)
        else:
            # 获取 prev_id & next_id
            # 上一张和下一张
            prev_photo = Photo.query.filter(and_(Photo.id<pid, Photo.album_id==aid)).order_by(Photo.id.desc()).first()
            if prev_photo:
                prev_id = prev_photo.id
            next_photo = Photo.query.filter(and_(Photo.id>pid, Photo.album_id==aid)).first()
            if next_photo:
                next_id = next_photo.id
    return render_template(
        'photo/photo.html',
        photo=photo,
        prev_id=prev_id,
        next_id=next_id,
        title='查看照片'
    )
Ejemplo n.º 30
0
def register():
    # 已登录用户则返回首页
    if g.user.is_authenticated:
        return redirect(url_for('frontend.index'))

    register_form = RegisterForm()
    if register_form.validate_on_submit():
        ip = get_client_ip()
        people = People(
            email=register_form.email.data,
            password=register_form.password.data,
            nickname=register_form.nickname.data,
            mobile=register_form.mobile.data,
            reg_time=datetime.datetime.utcnow(),
            reg_ip=ip,
        )
        # 将用户写入数据库
        db.session.add(people)
        db.session.commit()
        db.session.close()
        flash('注册成功', 'success')
        return redirect(url_for('frontend.index'))
    return render_template('register.html', register_form=register_form)
Ejemplo n.º 31
0
def register():
    # 已登录用户则返回首页
    if g.user.is_authenticated:
        return redirect(url_for('frontend.index'))

    register_form = RegisterForm()
    if register_form.validate_on_submit():
        ip = get_client_ip()
        people = People(
            email=register_form.email.data,
            password=register_form.password.data,
            nickname=register_form.nickname.data,
            mobile=register_form.mobile.data,
            reg_time=datetime.datetime.utcnow(),
            reg_ip=ip,
        )
        # 将用户写入数据库
        db.session.add(people)
        db.session.commit()
        db.session.close()
        flash('注册成功', 'success')
        return redirect(url_for('frontend.index'))
    return render_template('register.html', register_form=register_form)
Ejemplo n.º 32
0
def modify_album(id):
    """修改相册属性"""
    album = PhotoAlbum.query.get_or_404(id)
    if album.people_id != g.user.id:
        flash('权限不足', 'warning')
        return redirect(url_for('show_album', id=album.id))
    if album.title == '默认相册':
        flash('无法修改属性', 'warning')
        return redirect(url_for('show_album', id=album.id))
    modify_album_form = ModifyAlbumForm(obj=album)
    if modify_album_form.validate_on_submit():
        album.title = modify_album_form.title.data
        album.description = modify_album_form.description.data

        db.session.add(album)
        db.session.commit()
        flash('相册修改成功', 'success')
        return redirect(url_for('show_album', id=album.id))

    return render_template(
        'photo/album-info.html',
        form=modify_album_form,
        title='修改相册属性'
    )
Ejemplo n.º 33
0
def avatar():
    avatar_form = AvatarForm()
    if avatar_form.validate_on_submit():
        if avatar_form.avatar.data:
            # 上传头像
            avatar_filename = g.user.get_avatar_uri()
            avatar_data = request.files[avatar_form.avatar.name]
            uploader = get_uploader()
            avatar_filename = uploader.save(avatar_data)
            if not avatar_filename:
                flash('上传失败', 'danger')
                return redirect(url_for('account.avatar'))
            # url = photos.url(avatar_filename)
            # print url
            # old_avatar = photos.url(people.avatar)
            # os.remove(old_avatar)   # 删除旧头像
            print avatar_filename
            g.user.change_avatar(avatar_filename)
            db.session.add(g.user)
            db.session.commit()
            flash('上传成功', 'success')
            return redirect(url_for('account.avatar'))

    return render_template('avatar.html', avatar_form=avatar_form, title='修改头像')
Ejemplo n.º 34
0
def square():
    microblogs = Microblog.query.order_by(Microblog.post_time.desc()).all()
    # print microblogs
    return render_template('square.html',
                           microblogs=microblogs,
                           post_form=PostForm())
Ejemplo n.º 35
0
def show_notification():
    notifications = Notification.query.filter_by(to_id=g.user.id).order_by(Notification.create_time.desc()).all()
    return render_template('notification.html', notifications=notifications)
Ejemplo n.º 36
0
def show_about():
    return render_template('about.html')
Ejemplo n.º 37
0
def index():
    return render_template('admin/index.html')
Ejemplo n.º 38
0
def people(id):
    people = People.query.get_or_404(id)
    return render_template('people.html', people=people)
Ejemplo n.º 39
0
def show_people(page):
    pagination = People.query.paginate(page, per_page=50)
    people = pagination.items
    return render_template('admin/people.html',
                           people=people,
                           pagination=pagination)
Ejemplo n.º 40
0
def index():
    return render_template('admin/index.html')