Пример #1
0
def edit_album(album_id=None):
    """
    Displays a form to either add or edit a photo album. If the album is
    created from scratch or updates an existing depends on the presence of the
    ``album_id`` parameter.
    """

    album = None
    if album_id is not None:
        album = PhotoAlbums.by_id(album_id)
        if album is None:
            raise NotFound("Photo album not found.")

    if request.method == "POST":
        form = PhotoAlbumForm(request.form, obj=album)
        if form.validate():
            form.save(album)

            if album is None:
                flash("New album created.")
            else:
                flash("Album saved.")
            return redirect(url_for("photos.index"))
    else:
        form = PhotoAlbumForm(obj=album)

    return render_template('admin/photos.html',
        form=form,
        album_id=album_id)
Пример #2
0
def about():
    return render_template("about.html")
Пример #3
0
def blog_index():
    return render_template("blog.html")
Пример #4
0
def home():
    return render_template("index.html")