Skip to main content
Baka model add-ons
==================

`Baka_model <https://github.com/suryakencana/baka_model>`_. 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_model, 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_model
pyramid_debugtoolbar
pyramid_mailer


Install with code

.. code:: python

def includeme(config):
config.include('baka_model')

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

baka_model-0.18.7.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

baka_model-0.18.7-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

Details for the file baka_model-0.18.7.tar.gz.

File metadata

  • Download URL: baka_model-0.18.7.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for baka_model-0.18.7.tar.gz
Algorithm Hash digest
SHA256 d18708703738c77455c1536fcda4d0636bee12fc318f115fa2552da83e49634b
MD5 b546829a637c11490094ba568e2ab787
BLAKE2b-256 a301a23ff838a8357ddfb197b929854c5cbf7295391143a70a2719586be8c0a8

See more details on using hashes here.

File details

Details for the file baka_model-0.18.7-py3-none-any.whl.

File metadata

File hashes

Hashes for baka_model-0.18.7-py3-none-any.whl
Algorithm Hash digest
SHA256 d00410f173349209e782e0e007e33645244c11603327501d65e8e595ea6a89a1
MD5 de5c4dfeeaa34a380314c0e6e3e083b2
BLAKE2b-256 bd3e49e3b7f3f693a3277375b3275d497070e2b2485c6acbbbef3631e831fb86

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.18.7 This release

2 files

0.18.5

2 files

0.18.3

2 files

0.18.1

2 files

0.18.0

2 files

0.17.9

3 files

0.17.7

3 files

0.17.5

1 file

0.17.3

0.17.1

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page