Baka: Skeleton framework built top of pyramid, baka_tenshi for sqlalchemy
Project description
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')
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
baka_tenshi-1.0.2.tar.gz
(11.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file baka_tenshi-1.0.2.tar.gz.
File metadata
- Download URL: baka_tenshi-1.0.2.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5bcf95b384d3efd131f2cc9589816f0013fd861dade00e14f0e38260eaaa534e
|
|
| MD5 |
150d5e4620da05e0d0f853784a34d1c7
|
|
| BLAKE2b-256 |
7fc14e19ba4f59e233e23da066fe86b7d2b6d58f0d2d2beb48e53e12459fca46
|
File details
Details for the file baka_tenshi-1.0.2-py3-none-any.whl.
File metadata
- Download URL: baka_tenshi-1.0.2-py3-none-any.whl
- Upload date:
- Size: 14.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
967819fbbc2b47c05a0c511503230ae4dcec9742afec2ad61f7c8c30d9b98c9b
|
|
| MD5 |
f28e43667128fd5443bc88220e45648a
|
|
| BLAKE2b-256 |
747bec7213b2d329a7475b7939c1c4b050284f51f39bb2dfda1c759613c9422f
|