{ "info": { "author": "dracarysX", "author_email": "huiquanxiong@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "django-rest-query\n===================\n\nA rest query request args parser for django orm. like no-sql select style.(/?select=id,name,author{*}&id=gte.20&order=id.desc).\n\nInstalling\n------------\n\n``pip install django-rest-query``\n\nTest\n------------\n\n``python setup.py test``\n\nUsage\n------------\n\nDjango orm must use project shell. so wo start demo project::\n\n django-admin startproject demo\n\nAdd Model::\n\n class School(models.Model):\n id = models.AutoField(primary_key=True)\n name = models.CharField(max_length=100)\n\n class Meta:\n db_table = 'School'\n\n def __str__(self):\n return 'School: {}'.format(self.name)\n\n class Author(models.Model):\n id = models.AutoField(primary_key=True)\n name = models.CharField(max_length=50)\n age = models.IntegerField()\n school = models.ForeignKey(School)\n\n class Meta:\n db_table = 'Author'\n\n def __str__(self):\n return 'Author: {}'.format(self.name)\n\n class Book(models.Model):\n id = models.AutoField(primary_key=True)\n name = models.CharField(max_length=50)\n author = models.ForeignKey(Author)\n publisher = models.ForeignKey(Publisher)\n\n class Meta:\n db_table = 'Book'\n\n def __str__(self):\n return 'Book: {}'.format(self.name)\n\nUsage::\n\n python manage.py shell\n >>> from django_rest_query import *\n >>> from demo.models import Book, Author, School\n >>> args = {\n 'select': 'id,name,author{id,name,school{*}}',\n 'id': 'gte.20',\n 'author.id': 'in.10,20,30,40,50',\n 'order': 'id.desc',\n 'page': 1,\n 'limit': 5\n }\n >>> builder = DjangoQueryBuilder(Book, args)\n builder.select\n ['author__school__*', 'author__id', 'author__name', 'id', 'name']\n >>> build.where\n {'author__id__in': [10, 20, 30, 40, 50], 'id__gte': '20'}\n >>> builder.order\n ['-id']\n >>> builder.paginate\n (1, 5)\n {'start': 0, 'end': 5, 'limit': 5, 'page': 1}\n >>> builder.build()\n \n\nLicense\n----------\n\nMIT\n\nContacts\n----------\n\nEmail: huiquanxiong@gmail.com", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/dracarysX/django-rest-query", "keywords": "rest,query,no-sql,parser,django", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "django-rest-query", "package_url": "https://pypi.org/project/django-rest-query/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-rest-query/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/dracarysX/django-rest-query" }, "release_url": "https://pypi.org/project/django-rest-query/0.1.1/", "requires_dist": null, "requires_python": null, "summary": "A rest query request args parser for django orm.", "version": "0.1.1" }, "last_serial": 2984102, "releases": { "0.1.1": [] }, "urls": [] }