Skip to content

A simple Flask extension implements the similar function as Django's message framework.

Notifications You must be signed in to change notification settings

reterVision/flask-pigeon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask-Pigeon

  • Flask Messages Framework
  • A simple Flask extension implements the similar function as Django's messages framework.
  • Example included, but very bind to Bootstrap.

Installation

pip install flask-pigeon

Examples

app.py

from flask import Flask, render_template
from flask.ext import pigeon
app = Flask("APP")
pigeon = pigeon.Pigeon(app)


@app.route("/")
def index():
    pigeon.info("Hello")
    pigeon.error("Hello")
    pigeon.success("Hello")
    pigeon.warning("Hello")
    return render_template("home.html")

_message.html

<div class="span6">
    {% if messages %}
    {% for message in messages %}
    <div class="alert {{ message.tag }}">
        <button type="button" class="close" data-dismiss="alert">&times;</button>
        <h2>{{ message.message }}</h2>
        See?
    </div>
    {% endfor %}
    {% else %}
    <h1>Hello World!</h1>
    {% endif %}
</div>

home.html

<!doctype html>
	<head>
		<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
		<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet">
		<title>Hello from Flask</title>
	</head>
	<body>
		<div class="container">
		{% include "_message.html" %}
		</div>
		<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js"></script>
	</body>
</html>

About

A simple Flask extension implements the similar function as Django's message framework.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages