{ "info": { "author": "Devang Padhiyar", "author_email": "devangpadhiyar700@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# Django Validators\n\nDjango validators provides validator function that can be used with Django form fields and Django rest framework \nserializer fields\n\n### Installation\n\nInstall `django-validators` using `pip`\n\n`pip install django-validators`\n\n### Types of validators\n\n#### File validators\n\n- **Mime type validator** `djangovalidators.validators.MimetypeValidator`\n\n This validator is used to check mime type/ content type of the uploaded file. This validator checks file header \n information to check mime type on `FileField`\n\n example\n\n ```python\n from djangovalidators.validators import MimetypeValidator\n\n # with django forms\n class DemoForm(forms.Form):\n CONTENT_TYPES = ('image/png', 'application/pdf', 'image/jpeg', 'image/jpg', 'image/tiff',)\n file_object = forms.FileField(validators=[MimetypeValidator(CONTENT_TYPES)])\n\n # with django serializers\n class DemoSerializer(serializers.Serializer):\n CONTENT_TYPES = ('image/png', 'application/pdf', 'image/jpeg', 'image/jpg', 'image/tiff',)\n FILE_SIZE_IN_BYTES = 1024 * 1024 * 5 # ~5 Mib\n file_object = serializers.FileField(validators=[MimetypeValidator(CONTENT_TYPES)])\n ```\n\n- **File size validator** `djangovalidators.validators.FileSizeValidator`\n\n This validator is useful for validating file size in `FileField`\n\n example\n\n ```python\n from djangovalidators.validators import FileSizeValidator\n\n # with django forms\n class DemoForm(forms.Form):\n FILE_SIZE_IN_BYTES = 1024 * 1024 * 5 # ~5 Mib\n file_object = forms.FileField(validators=[FileSizeValidator(FILE_SIZE_IN_BYTES)])\n\n # with django serializers\n class DemoSerializer(serializers.Serializer):\n FILE_SIZE_IN_BYTES = 1024 * 1024 * 5 # ~5 Mib\n file_object = serializers.FileField(validators=[FileSizeValidator(FILE_SIZE_IN_BYTES)])\n ```\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/devangpadhiyar/django-validators", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "django-validators", "package_url": "https://pypi.org/project/django-validators/", "platform": "", "project_url": "https://pypi.org/project/django-validators/", "project_urls": { "Homepage": "https://github.com/devangpadhiyar/django-validators" }, "release_url": "https://pypi.org/project/django-validators/1.0.1/", "requires_dist": [ "Django (>=1.8)", "python-magic (>=0.4.15)" ], "requires_python": "", "summary": "Django validators used for commonly used validations", "version": "1.0.1" }, "last_serial": 4958214, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "8227c124ad3d05cce715a83af021898e", "sha256": "f9520e51896f93ca9934fc8a87e364c7f5aa013955094850931b9e663a9fa536" }, "downloads": -1, "filename": "django_validators-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "8227c124ad3d05cce715a83af021898e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3283, "upload_time": "2019-03-14T11:29:54", "url": "https://files.pythonhosted.org/packages/2e/6b/91d7fc6f96afb1f90b507f0562c8d5d79c2bd270c4b4b7ba61ed158aae35/django_validators-1.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "067b44007fec0318217f179bde4f3b0a", "sha256": "efe6ac3d4dff7f9719183c36a0c33b424501b9f4025fe708e980f84121160129" }, "downloads": -1, "filename": "django-validators-1.0.0.tar.gz", "has_sig": false, "md5_digest": "067b44007fec0318217f179bde4f3b0a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1766, "upload_time": "2019-03-14T11:29:56", "url": "https://files.pythonhosted.org/packages/3c/41/5f107d21d1fe9242276ba17ef1fe5e6f009a50e0f1601bfe70dc0d0efe03/django-validators-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "5f4aa6369a64a8958604ac941d5c1464", "sha256": "0232118de8440840a3d1e316dd91029fa6c5a57615b8ddfba74a595eb15117bc" }, "downloads": -1, "filename": "django_validators-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "5f4aa6369a64a8958604ac941d5c1464", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3712, "upload_time": "2019-03-19T11:24:26", "url": "https://files.pythonhosted.org/packages/6c/c8/fef5aee295373078eab4dfbe04a2afeab1a72f7f752c0f294b4834de1c60/django_validators-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d282a14ce1de318808752c91f999b771", "sha256": "9f8d7502380eef1914decd6d7930b644036fc568381aab65e1afeb89515aa0a3" }, "downloads": -1, "filename": "django-validators-1.0.1.tar.gz", "has_sig": false, "md5_digest": "d282a14ce1de318808752c91f999b771", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2339, "upload_time": "2019-03-19T11:24:28", "url": "https://files.pythonhosted.org/packages/90/31/7996446474d8bebb254bda5bffe2c608310748d15b62fe58d49d114cba3c/django-validators-1.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5f4aa6369a64a8958604ac941d5c1464", "sha256": "0232118de8440840a3d1e316dd91029fa6c5a57615b8ddfba74a595eb15117bc" }, "downloads": -1, "filename": "django_validators-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "5f4aa6369a64a8958604ac941d5c1464", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 3712, "upload_time": "2019-03-19T11:24:26", "url": "https://files.pythonhosted.org/packages/6c/c8/fef5aee295373078eab4dfbe04a2afeab1a72f7f752c0f294b4834de1c60/django_validators-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d282a14ce1de318808752c91f999b771", "sha256": "9f8d7502380eef1914decd6d7930b644036fc568381aab65e1afeb89515aa0a3" }, "downloads": -1, "filename": "django-validators-1.0.1.tar.gz", "has_sig": false, "md5_digest": "d282a14ce1de318808752c91f999b771", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2339, "upload_time": "2019-03-19T11:24:28", "url": "https://files.pythonhosted.org/packages/90/31/7996446474d8bebb254bda5bffe2c608310748d15b62fe58d49d114cba3c/django-validators-1.0.1.tar.gz" } ] }