Skip to main content

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')

Info Message

Success

msg.success('This is a success message')

Success Message

Warning

msg.warning('This is a warning ')

Warning Message

Error

msg.error('This is a error')

Error Message

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.

Error Message

  #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


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)

Uploaded Source

Built Distribution

FlashBootstrap-1.0a1-py3-none-any.whl (16.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page