Baka model add-ons
==================
`Baka_tenshi <https://github.com/suryakencana/Baka_tenshi>`_. is add-ons baka framework built top of pyramid that provides an SQLAlchemy
declarative ``Base`` alias model.Model and a add method on ``request.db``.
Usage
-----
You can use these as base classes for declarative model definitions, e.g.
.. code:: python
from base_model.model import Model
class MyModel(Model):
"""Example model class."""
__tablename__ = 'base.mymodel'
@classmethod
def do_first(cls, session):
instance = session.query(cls).first()
Register Model
--------------
using Baka_tenshi, you can apply dependency injection method for model that has been created.
.. code:: python
def includeme(config):
config.register_model('base.MyModel')
# in view handler request
@route('/my.model', renderer='json')
def view_mymodel(request):
MyModel = request.find_model('base.mymodel')
mymodel = MyModel()
mymodel.name = 'user model'
mymodel.address = 'user address'
mymodel.phone = '0089800-998'
request.db.add(mymodel)
return {'success': True}
Install
-------
Install with ``.ini`` file
.. code:: bash
pyramid.includes =
Baka_tenshi
pyramid_debugtoolbar
pyramid_mailer
Install with code
.. code:: python
def includeme(config):
config.include('Baka_tenshi')
==================
`Baka_tenshi <https://github.com/suryakencana/Baka_tenshi>`_. is add-ons baka framework built top of pyramid that provides an SQLAlchemy
declarative ``Base`` alias model.Model and a add method on ``request.db``.
Usage
-----
You can use these as base classes for declarative model definitions, e.g.
.. code:: python
from base_model.model import Model
class MyModel(Model):
"""Example model class."""
__tablename__ = 'base.mymodel'
@classmethod
def do_first(cls, session):
instance = session.query(cls).first()
Register Model
--------------
using Baka_tenshi, you can apply dependency injection method for model that has been created.
.. code:: python
def includeme(config):
config.register_model('base.MyModel')
# in view handler request
@route('/my.model', renderer='json')
def view_mymodel(request):
MyModel = request.find_model('base.mymodel')
mymodel = MyModel()
mymodel.name = 'user model'
mymodel.address = 'user address'
mymodel.phone = '0089800-998'
request.db.add(mymodel)
return {'success': True}
Install
-------
Install with ``.ini`` file
.. code:: bash
pyramid.includes =
Baka_tenshi
pyramid_debugtoolbar
pyramid_mailer
Install with code
.. code:: python
def includeme(config):
config.include('Baka_tenshi')
Metadata
Release files for baka-tenshi 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| baka_tenshi-1.0.3.tar.gz | 11.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| baka_tenshi-1.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.9 kB
Release files / baka_tenshi-1.0.3.tar.gz
| Download URL | baka_tenshi-1.0.3.tar.gz |
|---|---|
| Size | 11.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3f8f2a134ee2b644158a00f562114182698d54880cc843a0f316053275ead87d
|
|
BLAKE2b-256 checksum How to use checksums |
3454ada81c79cfe29331a37442342cd9a9831b8319d990e22edae4e56630ca40
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / baka_tenshi-1.0.3-py3-none-any.whl
| Download URL | baka_tenshi-1.0.3-py3-none-any.whl |
|---|---|
| Size | 14.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fee64ccc5bfe8f878b2e7cc1b5db0508a6466782c089c09bb501a3295cbe5cb8
|
|
BLAKE2b-256 checksum How to use checksums |
ff9d7fff65f11ad926b44847045fd3a40e845afe2c71a63adcdb3a84f071b39f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |