{ "info": { "author": "Angel Velasquez", "author_email": "angvp@archlinux.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Internet :: WWW/HTTP" ], "description": "drf-lafv\n======================================\n\n|build-status-image| |pypi-version|\n\nOverview\n--------\n\nA better way than DRF proposed for do some basic filters\n\nRequirements\n------------\n\n- Python (2.7,3.2,3.3,3.4, 3.5 -with Django 1.8-)\n- Django (1.7, 1.8)\n- Django REST Framework (3.0, 3.1, 3.2)\n\nInstallation\n------------\n\nInstall using ``pip``\\ \u2026\n\n.. code:: bash\n\n $ pip install drf-lafv\n\nExample\n-------\n\nImagine that you have the following models.py\n\n.. code:: python\n\n from django.db import models\n\n\n class Author(models.Model):\n name = models.CharField(max_length=250)\n nickname = models.CharField(max_length=100)\n\n\n class Book(models.Model):\n title = models.CharField(max_length=200)\n description = models.TextField()\n publication_date = models.DateField()\n isbn = models.CharField(max_length=17)\n author = models.ForeignKey(Author)\n\n\nAnd you want to filter your list of books by author's nickname, isbn and create\na custom filter which will allow to get you books that were published less than\n30 days ago. Well, DRF per se, ask you to install django-filter and write a\nbunch of stuff that maybe hard. With ``lafv`` you can accomplish this doing this:\n\n\n.. code:: python \n\n from lafv.views import ListAPIFilteredView\n from serializers import BookSerializer\n\n\n class BookView(ListAPIFilteredView):\n queryset = Book.objects.all()\n serializer_class = BookSerializer\n filter_fields = ('author__nickname', 'isbn')\n custom_filters = ('new', )\n\n def filter_new(self, queryset):\n \"\"\"\n get books that publication date is no longer than 1 month\n \"\"\"\n last_month = datetime.today() - timedelta(days=30)\n queryset = queryset.filter(publication_date__gte=last_month)\n return queryset\n\n\nAnd that's it!, please check the examples on the test app\n\nTesting\n-------\n\nInstall testing requirements.\n\n.. code:: bash\n\n $ pip install -r requirements.txt\n\nRun with runtests.\n\n.. code:: bash\n\n $ ./runtests.py\n\nYou can also use the excellent `tox`_ testing tool to run the tests\nagainst all supported versions of Python and Django. Install tox\nglobally, and then simply run:\n\n.. code:: bash\n\n $ tox\n\nDocumentation\n-------------\n\nTo build the documentation, you\u2019ll need to install ``mkdocs``.\n\n.. code:: bash\n\n $ pip install mkdocs\n\nTo preview the documentation:\n\n.. code:: bash\n\n $ mkdocs serve\n Running at: http://127.0.0.1:8000/\n\nTo build the documentation:\n\n.. code:: bash\n\n $ mkdocs build\n\n.. _tox: http://tox.readthedocs.org/en/latest/\n\n.. |build-status-image| image:: https://secure.travis-ci.org/angvp/drf-lafv.svg?branch=master\n :target: http://travis-ci.org/angvp/drf-lafv?branch=master\n.. |pypi-version| image:: https://img.shields.io/pypi/v/drf-lafv.svg\n :target: https://pypi.python.org/pypi/drf-lafv\n", "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/angvp/drf-lafv", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "drf-lafv", "package_url": "https://pypi.org/project/drf-lafv/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/drf-lafv/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/angvp/drf-lafv" }, "release_url": "https://pypi.org/project/drf-lafv/0.0.2/", "requires_dist": null, "requires_python": null, "summary": "A better way than DRF proposed for do some basic filters", "version": "0.0.2" }, "last_serial": 1770218, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "092d012e2d6295f8212c6afaec86f958", "sha256": "f4998ce7d464d405b07f9d37c5213bbdfb6e62a6c0d437086ce0664ecdaa4c97" }, "downloads": -1, "filename": "drf_lafv-0.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "092d012e2d6295f8212c6afaec86f958", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 2949, "upload_time": "2015-10-14T04:07:20", "url": "https://files.pythonhosted.org/packages/51/6d/8aeae0836643c092353484b492108266653923cedeed19b2eaf1b01bc354/drf_lafv-0.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "bf41bed52dd14d8fdc2572bac29f6c20", "sha256": "6155ba6098944a72c311a382727e4062bf78ff91ceacd1cc400a37ed293e7e81" }, "downloads": -1, "filename": "drf-lafv-0.0.1.tar.gz", "has_sig": false, "md5_digest": "bf41bed52dd14d8fdc2572bac29f6c20", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3362, "upload_time": "2015-10-14T04:07:01", "url": "https://files.pythonhosted.org/packages/ed/cb/4a42633817f2d73b1259ba729fe9b3bf0d34d002ad3bab13877d6410bc43/drf-lafv-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "dd57ccf430235fbfeabe20eeb9f36bb4", "sha256": "67f34bc4d5cdfce5fc9f36f2845af9475c329ea5b9ed711d15d4e095b840ed84" }, "downloads": -1, "filename": "drf_lafv-0.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "dd57ccf430235fbfeabe20eeb9f36bb4", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 2953, "upload_time": "2015-10-15T14:46:22", "url": "https://files.pythonhosted.org/packages/59/1f/74b7e15582123366bca7d5f0bedb132ee5f29652f12fa1164173d42709e3/drf_lafv-0.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "32db0f0497e61477b7671444bcaa5c0c", "sha256": "c5ab9e573860e77c2a74b5bb763e6b2669fb7c1cfae7b5f2dadf64e5eccc064c" }, "downloads": -1, "filename": "drf-lafv-0.0.2.tar.gz", "has_sig": false, "md5_digest": "32db0f0497e61477b7671444bcaa5c0c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3918, "upload_time": "2015-10-15T14:46:01", "url": "https://files.pythonhosted.org/packages/14/be/0e4095058e985e907cf0631f76297ebe2d0147e093dd0f796625650912ea/drf-lafv-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "dd57ccf430235fbfeabe20eeb9f36bb4", "sha256": "67f34bc4d5cdfce5fc9f36f2845af9475c329ea5b9ed711d15d4e095b840ed84" }, "downloads": -1, "filename": "drf_lafv-0.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "dd57ccf430235fbfeabe20eeb9f36bb4", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 2953, "upload_time": "2015-10-15T14:46:22", "url": "https://files.pythonhosted.org/packages/59/1f/74b7e15582123366bca7d5f0bedb132ee5f29652f12fa1164173d42709e3/drf_lafv-0.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "32db0f0497e61477b7671444bcaa5c0c", "sha256": "c5ab9e573860e77c2a74b5bb763e6b2669fb7c1cfae7b5f2dadf64e5eccc064c" }, "downloads": -1, "filename": "drf-lafv-0.0.2.tar.gz", "has_sig": false, "md5_digest": "32db0f0497e61477b7671444bcaa5c0c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3918, "upload_time": "2015-10-15T14:46:01", "url": "https://files.pythonhosted.org/packages/14/be/0e4095058e985e907cf0631f76297ebe2d0147e093dd0f796625650912ea/drf-lafv-0.0.2.tar.gz" } ] }