{ "info": { "author": "Simon Chapman - Team Swift", "author_email": "simon.chapman@saffrondigital.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Development Status :: 6 - Mature", "Environment :: Plugins", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", "Natural Language :: English", "Operating System :: Unix", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Topic :: Database", "Topic :: Database :: Database Engines/Servers", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Internet :: WWW/HTTP :: HTTP Servers", "Topic :: Software Development", "Topic :: Software Development :: Libraries :: Application Frameworks", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "README\r\n---------------------------------\r\n\r\nWafer Thin Mint, is a package that allows full integration, with ease, to the TastyPie distro.\r\n\r\nIt provides a simple and elegant way, to connect straight to the DB API's with minimal effort,\r\nfollowing the same pattern as the Django DB ORM.\r\n\r\nPlease see below for instructions on setup, and have a happy usage :)\r\n\r\n\r\nSETTINGS\r\n---------------------------------\r\n\r\nfirst add to your installed apps\r\n\r\nINSTALLED_APPS = {\r\n ...\r\n 'wafer_thin_mint',\r\n}\r\n\r\n\r\nfollowing the example below - please add to your settings file\r\n\r\nWAFER_THIN_MINT = {\r\n # the connector model can either be the default wafer-thin-mint Server to Server auth model, or a bespoke (see \"wafer_thin_mint.Connector\" for reference)\r\n 'connector_model': 'wafer_thin_mint.Connector',\r\n # the client information takes the host, suffix (if you dont want json), and table routing urls\r\n 'client': {\r\n 'host': 'http://127.0.0.1',\r\n 'suffix': '?format=json',\r\n 'tables': {\r\n 'client': '/api/v1/client/',\r\n 'territory': '/api/v1/territory/',\r\n }\r\n }\r\n}\r\n\r\n\r\n\r\nUSAGE\r\n---------------------------------\r\n\r\nModel\r\n-----\r\n\r\nIn your db api models file (example remote_db.py) add the structures as below, you'll recognise the format\r\nfrom the Django DB ORM - this is intentional to act as a simple and easy to use way to map at a similar db\r\nhowever over a remote API system.\r\n\r\nFirstly, import wafer-thin-mint\r\n\r\n#########################################\r\n\r\nfrom wafer_thin_mint import core\r\n\r\n#########################################\r\n\r\nNow we can build our models\r\n\r\n#########################################\r\n\r\n# first off you'll see the 'Model' parent, this maps to a class that houses the metaclass that does all the\r\n# work, this keeps everything nicely abstracted from view.\r\n\r\nclass Client(core.Model):\r\n # now we build our structure, alike the Django DB ORM we list our desired mapping fields and 'type' them\r\n # i will list the choices at the end\r\n id = core.PrimaryKey\r\n client_reference = core.Charfield\r\n description = core.Charfield\r\n\r\n#######################################\r\n\r\nNow we have our model, and its all setup for use! So how do we use it?\r\nWell you probably already know how.. you just dont realise it yet.\r\n\r\nAgain we've maintained the structure of the Django DB ORM and created it like so.\r\n\r\n#######################################\r\n\r\n# module.py\r\nfrom my_app import remote_db\r\n\r\nc = Client.objects.get(id=1)\r\n\r\n# we now have our 'client' retrieved via the API to the TastyPie interface!\r\n\r\nprint c.id\r\n# 1\r\n\r\nprint c.description\r\n# some client description\r\n\r\n# neat eh?\r\n\r\n# now i mentioned earlier about a different method of choosing our settings file.. well we can use the 'using()' param\r\n# for this, again, alike that of the DB ORM, just a different usecase\r\n\r\nc = Client.objects.using('my_app.settings').get(id=2)\r\n\r\nprint c.id\r\n# 2\r\n\r\n#######################################\r\n\r\nDo ensure you set your mapping up correctly however, making sure the points you try to connect to are actually\r\nqueryable, and also, make sure your TastyPie has the 'exact' pointer in use, as this is essential in the fetching\r\nmethod.\r\n\r\nNow finally, what 'types' are available for our fields? Well because we dont want to boil down too many specifics\r\nwhen the remote API will handle most of it, we've generalised the following, this will just prevent the small int/str\r\nerrors etc\r\n\r\nPrimaryKey - do ensure this is used on your pk, especially if you plan on using it with foriegn table references\r\nCharField - says it like it is, types a str\r\nIntegerField - again, a bit obvious\r\nDecimalField - references the Decimal module\r\nTextField - again, alike the str\r\nForiegnKey - this is used for identifying your table object, which is possible alike the DB ORM, simply reference your\r\n fetched object and all will be mapped accordingly", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/teamswift/wafer-thin-mint", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/teamswift/wafer-thin-mint", "keywords": "tastypie, wafer-thin-mint, django, orm, database, api", "license": "GNU v2", "maintainer": "", "maintainer_email": "", "name": "wafer-thin-mint", "package_url": "https://pypi.org/project/wafer-thin-mint/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/wafer-thin-mint/", "project_urls": { "Download": "https://github.com/teamswift/wafer-thin-mint", "Homepage": "https://github.com/teamswift/wafer-thin-mint" }, "release_url": "https://pypi.org/project/wafer-thin-mint/1.0.13/", "requires_dist": null, "requires_python": null, "summary": "client service API DB ORM to connect with a service running TastyPie", "version": "1.0.13" }, "last_serial": 1237498, "releases": { "1.0.11": [ { "comment_text": "", "digests": { "md5": "b437cd0fb36d8e512f46c7147edca5b1", "sha256": "a7ec0527c713ab1a14d81d475eb4fc96b5d523fd3cf183fd0ed638d46de04700" }, "downloads": -1, "filename": "wafer-thin-mint-1.0.11.tar.gz", "has_sig": false, "md5_digest": "b437cd0fb36d8e512f46c7147edca5b1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5653, "upload_time": "2014-09-24T12:28:27", "url": "https://files.pythonhosted.org/packages/a1/e3/5eb6b56c3ecca6facb4a8b078160512b6589561235ab6a22aeef4e3ccaa9/wafer-thin-mint-1.0.11.tar.gz" } ], "1.0.12": [ { "comment_text": "", "digests": { "md5": "6705927cebf10ec862e6186c24168332", "sha256": "5fa91d29d0ad2f62f3685cccd222c4d73692f555e60e73bd4f5c8f7321d0d4e4" }, "downloads": -1, "filename": "wafer-thin-mint-1.0.12.tar.gz", "has_sig": false, "md5_digest": "6705927cebf10ec862e6186c24168332", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5596, "upload_time": "2014-09-24T14:17:00", "url": "https://files.pythonhosted.org/packages/33/e4/93dbd6fddd41929803a2917f861e654497ff2a5fa0c63bb98f9929e05121/wafer-thin-mint-1.0.12.tar.gz" } ], "1.0.13": [ { "comment_text": "", "digests": { "md5": "ce032315948aabd72fc7b3d7fc5848e5", "sha256": "c505deb6506111788af7684fcc5538f89d9e4f2d01b81869f6f3219fe8ff5ea4" }, "downloads": -1, "filename": "wafer-thin-mint-1.0.13.tar.gz", "has_sig": false, "md5_digest": "ce032315948aabd72fc7b3d7fc5848e5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5648, "upload_time": "2014-09-25T08:56:06", "url": "https://files.pythonhosted.org/packages/14/9b/c13ca3c3e1e6e95c51847eeff7cf31af90dc5560e28e2a5b3859da400f1a/wafer-thin-mint-1.0.13.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ce032315948aabd72fc7b3d7fc5848e5", "sha256": "c505deb6506111788af7684fcc5538f89d9e4f2d01b81869f6f3219fe8ff5ea4" }, "downloads": -1, "filename": "wafer-thin-mint-1.0.13.tar.gz", "has_sig": false, "md5_digest": "ce032315948aabd72fc7b3d7fc5848e5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5648, "upload_time": "2014-09-25T08:56:06", "url": "https://files.pythonhosted.org/packages/14/9b/c13ca3c3e1e6e95c51847eeff7cf31af90dc5560e28e2a5b3859da400f1a/wafer-thin-mint-1.0.13.tar.gz" } ] }