Metadata-Version: 2.1
Name: Flask-Electron
Version: 0.4.9
Summary: Core code for Flask based projects
Home-page: https://github.com/kmjbyrne/flask-electron
Author: Keith Byrne
Author-email: keithmbyrne@gmail.com
License: MIT
Description: # KBPC
        
        ![GitHub](https://img.shields.io/github/license/kmjbyrne/kbpc)
        [![PyPI version](https://badge.fury.io/py/kbpc.svg)](https://badge.fury.io/py/kbpc)
        [![Build Status](https://travis-ci.org/kmjbyrne/kbpc.svg?branch=master)](https://travis-ci.org/kmjbyrne/kbpc)
        [![Coverage Status](https://coveralls.io/repos/github/kmjbyrne/kbpc/badge.svg?branch=master)](https://coveralls.io/github/kmjbyrne/kbpc?branch=master)
        
        Table of contents
        =================
        
        <!--ts-->
        
        * [Database](#database)
            * [Models](#models)
                * [User](#user)
                    * [User Model](#user-model)
                    * [User DAO](#user-dao)
            * [Serializer](#flask-alchemy-model-serializer)
        * [Common](#common)
            * [Exceptions](#exceptions)
            
        <!--te-->
        
        ## Database
        
        
        ### Models
        
        #### User Model
        
        Docs coming soon
        
        #### User DAO
        
        Docs coming soon
        
        ---
        
        ### Flask Alchemy Model Serializer
        
        
        Transformation was originally a series of routines written to convert FlaskAlchemy models into jsonifiable dict 
        structures. This proved to be a solution lacking elegance and evolved and eventually found its way into half a dozen 
        projects over time and eventually, then started to splinter into slightly different variations.
        
        #### Basic Usage
        
        ```python
        from flask import jsonify
        
        from application.models import SomeFlaskAlchemyModel
        from kbpc.db.flaskalchemy import serializer
        
        # Assume the model has name and age as the model fields
        model = SomeFlaskAlchemyModel('John Doe', 25)
        transformed_model = serializer.serialize(model)
        
        # This typically fails if you attempt it with the model.
        json = jsonify(data=model)
        
        # This however is serializable immediately
        json = jsonify(data=transformed_model)
        ```
        ---
        
        Often, fields like passwords or other sensitive data should be hidden from responses or outputs. Usually this would be 
        managed at the model class, and writing a to_dict() function or something similar, and simply not declaring the 
        protected properties of that instance.
        
        #### Protected Properties
        
        ```python
        from flask import jsonify
        
        from application.models import SomeFlaskAlchemyModel
        from kbpc.db.flaskalchemy import serializer
        
        # Assume the model has name and age as the model fields
        model = SomeFlaskAlchemyModel('John Doe', 25)
        tablename = 'tablename_of_model'
        exclusions = {tablename: ['age']}
        transformed_model = serializer.serialize(model, exclusions)
        
        # This however is serializable immediately
        json = jsonify(data=transformed_model)
        
        ```
        
        
Keywords: python library utilities
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.7
Description-Content-Type: text/markdown
