Store Flash messages in session data until they are retrieved. Bootstrap compatibility, sticky messages, and more.
Project description
Pytonik Bootstrap Flash Message
Store messages in session data until they are retrieved. Bootstrap compatibility, sticky messages, and more
Installation
With Pip
pip install FlashBootstrap
With Git
git clone https://github.com/emmamartins/FlashBootstrap/
Import the Module:
from FlashBootstrap.FlashBootstrap import FlashBootstrap
or
from FlashBootstrap.FlashBootstrap import *
Defualt Parameter
description=""
title=""
dismissible=True
key='flash'
Basic Usage
#Instantiate the class
msg = FlashBootstrap
#Add messages With Bootstrap
msg.info('This is an info message')
msg.success('This is a success message')
msg.warning('This is a warning message')
msg.error('This is an error message')
#Add messages Without Bootstrap
msg.message('This is an info message')
#Wherever you want to display the messages simply call:
msg.display()
Message Types
Info
msg.info('This is a info message')
Success
msg.success('This is a success message')
Warning
msg.warning('This is a warning ')
Error
msg.error('This is a error')
Redirect
It's possible to redirect to a different URL before displaying a message. For example, redirecting from checklogin back to a form login, (and displaying an error message) so a user can correct an error - subjected to pytonik developers.
#Import Pytonik
from pytonik.Web import app
#Import FlashBoostrap
from FlashBoostrap.FlashBoostrap import *
def checklogin():
FlashBoostrap.error('Cannot login account')
return app.redirect('/login', True)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
FlashBootstrap-1.0a1.tar.gz
(3.7 kB
view hashes)
Built Distribution
Close
Hashes for FlashBootstrap-1.0a1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0db6e0f6d1ea8e30e2cfc29f30e0b5c6db3d7f54576e3cc6d1fecf74990b9b32 |
|
MD5 | c27556b15150784536ac042a7efe06be |
|
BLAKE2b-256 | 84b35e19d8b9fca28ee783e46dcf9ba490cff97812e73be0f9b443ea1bc96b29 |