{ "info": { "author": "Suriya Subramanian", "author_email": "suriya@alumni.cs.utexas.edu", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "================\ndjango-xvalidate\n================\n\n.. image:: https://travis-ci.org/suriya/django-xvalidate.svg?branch=master\n :target: https://travis-ci.org/suriya/django-xvalidate\n.. image:: https://coveralls.io/repos/suriya/django-xvalidate/badge.svg?branch=master&service=github\n :target: https://coveralls.io/github/suriya/django-xvalidate?branch=master\n.. image:: https://img.shields.io/pypi/v/django-xvalidate.svg\n :target: https://pypi.python.org/pypi/django-xvalidate\n :alt: Latest PyPI version\n\ndjango-xvalidate allows you to declare cross-field validators within a\nDjango model.\n\nAs an example, consider a Django model named :code:`Event`.\n\n.. code:: python\n\n from django.db import models\n\n class Event(models.Model):\n title = models.CharField(max_length=255)\n start_date = models.DateField()\n end_date = models.DateField()\n\ndjango-xvalidate allows you to declare that the start date precedes the end\ndate as follows:\n\n.. code:: python\n\n from django.db import models\n from xvalidate import XValidatedModel, XLe\n\n class Event(XValidatedModel, models.Model):\n title = models.CharField(max_length=255)\n start_date = models.DateField()\n end_date = models.DateField()\n\n class XVMeta(XValidatedModel.XVMeta):\n spec = [\n XLe('start_date', 'end_date').message(\n 'The start date should precede the end date')\n ]\n\n:code:`XValidatedModel` ensures that this specification is maintained\ninvoking :code:`Event.clean()` and raises :code:`ValidationError` as\nappropriate.\n\nWhy use django-xvalidate?\n-------------------------\ndjango-xvalidate allows you to specify how to validate your model instances\nin a more declarative manner than writing imperative code within your\n:code:`clean()` methods. Without django-xvalidate you would have to\nimplement the above example as\n\n.. code:: python\n\n def clean(self):\n super(Event, self).clean()\n if (self.start_date is not None) and (self.end_date is not None):\n if (self.end_date < self.start_date):\n raise ValidationError('The start date should precede the end date')\n\nWith a more declarative format we have the option at some point in the\nfuture to automate the creation of test data that passes (or fails)\nvalidation.\n\ndjango-xvalidate comes some operator overloading that brings syntactic\nsugar to your declarations making them very easy to read. For instance,\nyou could specify:\n\n.. code:: python\n\n ((XF('end_date') - 'start_date') > datetime.timedelta(days=4)).message(\n 'Event should last at least 5 days'\n )\n\ndjango-xvalidate also allows the use of Django's double-underscore (`__`)\nsyntax to dereference related objects, enabling succinct definitions such\nas the following\n\n.. code:: python\n\n (XF('registration_date') <= 'event__end_date').message(\n 'Must register before the event ends')", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://www.github.com/suriya/django-xvalidate", "keywords": null, "license": "MIT License", "maintainer": null, "maintainer_email": null, "name": "django-xvalidate", "package_url": "https://pypi.org/project/django-xvalidate/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-xvalidate/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://www.github.com/suriya/django-xvalidate" }, "release_url": "https://pypi.org/project/django-xvalidate/0.4.2/", "requires_dist": null, "requires_python": null, "summary": "Cross-field validators within a Django model", "version": "0.4.2" }, "last_serial": 2702073, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "c01a5443137a0a345d56ac71ff0c11ea", "sha256": "c2606d036b2cfe4dee1ae0c667c713eaee9d2985010e1e345327ff47fa723fd9" }, "downloads": -1, "filename": "django-xvalidate-0.1.0.tar.gz", "has_sig": false, "md5_digest": "c01a5443137a0a345d56ac71ff0c11ea", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4271, "upload_time": "2015-09-27T14:53:51", "url": "https://files.pythonhosted.org/packages/1e/0c/c39036e338e7de675ef14c60ebc4c8b66bb38584796cf280fe1241f4f1aa/django-xvalidate-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "29d2224e8b5d0cbd6eadc1e0c1fb8c22", "sha256": "e2212d3197a6e59666a708d272a67e00696d73ec2470e13d1fa74b156f98c602" }, "downloads": -1, "filename": "django-xvalidate-0.2.0.tar.gz", "has_sig": false, "md5_digest": "29d2224e8b5d0cbd6eadc1e0c1fb8c22", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4615, "upload_time": "2015-10-04T17:35:56", "url": "https://files.pythonhosted.org/packages/1a/ae/1b173bddcc94af51bf81aa1e28d7d2bfbb521ee225c4a37460c5a488c7cd/django-xvalidate-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "c500284f8d442b61879998753b37a3cc", "sha256": "ba8fcabad889f9db928b3025575192f29c70572a5421ca571b58759aaa60d1d0" }, "downloads": -1, "filename": "django-xvalidate-0.3.0.tar.gz", "has_sig": false, "md5_digest": "c500284f8d442b61879998753b37a3cc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4819, "upload_time": "2015-10-05T08:24:25", "url": "https://files.pythonhosted.org/packages/74/a9/ed1c5591ea614e06caeff99e262a8a3e1e1af63940436e04b75a56d8014b/django-xvalidate-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "25ee8e41bf1fc6db68e795236cd3b7e4", "sha256": "fc84f087ad7dc9cfb06b855188d0dfbb00dc2b02c53514811da8fb02b7c2d520" }, "downloads": -1, "filename": "django-xvalidate-0.3.1.tar.gz", "has_sig": false, "md5_digest": "25ee8e41bf1fc6db68e795236cd3b7e4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4817, "upload_time": "2015-10-13T07:12:03", "url": "https://files.pythonhosted.org/packages/91/8c/84c73883dbb0928c476aaa0c10bad29d9e4ac54dc2daf9777ecd7a738944/django-xvalidate-0.3.1.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "06b872a8d37da75ea61b9bffae94f04f", "sha256": "feddc20bd6cea40875ae4504cba7956c156fd50ef27953d95a9e7422cc81ccb2" }, "downloads": -1, "filename": "django-xvalidate-0.4.0.tar.gz", "has_sig": false, "md5_digest": "06b872a8d37da75ea61b9bffae94f04f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5522, "upload_time": "2016-04-17T09:19:12", "url": "https://files.pythonhosted.org/packages/ad/63/ee8320c3eecd7daf4211ffa8826fe7c5dbbd97ae92e54630f994a9b2ae27/django-xvalidate-0.4.0.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "f747f1aadf06bc8fd45ba6795ab10a5b", "sha256": "f4b331fd68ec7b87d144c9aa12fc9828ab3086d4b419707dafa5e37ff55feba1" }, "downloads": -1, "filename": "django-xvalidate-0.4.1.tar.gz", "has_sig": false, "md5_digest": "f747f1aadf06bc8fd45ba6795ab10a5b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5445, "upload_time": "2016-08-12T04:52:15", "url": "https://files.pythonhosted.org/packages/ee/56/bc054a1f7a8808cfe60d3268231aa2dda59d2cffb144cd813c4c123b15a7/django-xvalidate-0.4.1.tar.gz" } ], "0.4.2": [ { "comment_text": "", "digests": { "md5": "7f64b4713c6c32beac0baa06891aea16", "sha256": "5f78409948f2ba56ba0c7a712eea325f3548803cac35b28a65030559af56f75a" }, "downloads": -1, "filename": "django-xvalidate-0.4.2.tar.gz", "has_sig": false, "md5_digest": "7f64b4713c6c32beac0baa06891aea16", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5537, "upload_time": "2017-03-13T10:40:39", "url": "https://files.pythonhosted.org/packages/7d/ac/a9a574315038cba8438c8dba47d16809bd49b7ab41316b5f6fdf63d2451c/django-xvalidate-0.4.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7f64b4713c6c32beac0baa06891aea16", "sha256": "5f78409948f2ba56ba0c7a712eea325f3548803cac35b28a65030559af56f75a" }, "downloads": -1, "filename": "django-xvalidate-0.4.2.tar.gz", "has_sig": false, "md5_digest": "7f64b4713c6c32beac0baa06891aea16", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5537, "upload_time": "2017-03-13T10:40:39", "url": "https://files.pythonhosted.org/packages/7d/ac/a9a574315038cba8438c8dba47d16809bd49b7ab41316b5f6fdf63d2451c/django-xvalidate-0.4.2.tar.gz" } ] }