{
"info": {
"author": "Marc Bourqui",
"author_email": "pypi.kemar@bourqui.org",
"bugtrack_url": null,
"classifiers": [
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Framework :: Django",
"Framework :: Django :: 1.10",
"Framework :: Django :: 1.11",
"Framework :: Django :: 1.8",
"Framework :: Django :: 1.9",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD 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.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
"Topic :: Utilities"
],
"description": "|Python| |Django| |License| |PyPIv| |PyPIs| |Build Status| |Coverage\nStatus|\n\nConstrainedFileField for Django\n===============================\n\nThis Django app adds a new field type, ``ConstrainedFileField``, that\nhas the capability of checking the file size and type. Also provides a\njavascript checker for the form field.\n\nFeatures\n--------\n\n- File size limitation\n- File type limitation\n- Javascript file size checker\n\nRequirements\n------------\n\n- `Python `__ >= 2.7\n- `Django `__>= 1.8.17\n- ``python-magic`` >= 0.4.2 *iff* you want to check the file type\n\nInstallation\n------------\n\nUsing PyPI\n~~~~~~~~~~\n\n1. Run\n\n- ``pip install django-constrainedfilefield``, or\n- ``pip install django-constrainedfilefield[filetype]`` to ensure\n ``python-magic`` is installed.\n\n1. For windows, you must download the dll files and .magic file at\n https://github.com/pidydx/libmagicwin64 (32-bit version:\n http://gnuwin32.sourceforge.net/packages/file.htm)), add them to\n C:\\\\Windows\\\\System32 (or to a folder in your PATH), and set\n MAGIC\\_FILE\\_PATH=\"...\" to the path of your .magic file in your\n settings.py. For more information about the files to download, go to:\n https://github.com/ahupp/python-magic/blob/43df08c5ed63d7aad839695f311ca1be2eeb1ecb/README.md#dependencies\n\nUsing the source code\n~~~~~~~~~~~~~~~~~~~~~\n\n1. Make sure `Pandoc `__ is installed\n2. Run ``./pypi_packager.sh``\n3. Run\n ``pip install dist/django_constrainedfilefield-x.y.z-[...].wheel``,\n where ``x.y.z`` must be replaced by the actual version number and\n ``[...]`` depends on your packaging configuration\n4. For windows, you must download the dll files and .magic file at\n https://github.com/pidydx/libmagicwin64 (32-bit version:\n http://gnuwin32.sourceforge.net/packages/file.htm)), add them to\n C:\\\\Windows\\\\System32 (or to a folder in your PATH), and set\n MAGIC\\_FILE\\_PATH=\"...\" to the path of your .magic file in your\n settings.py. For more information about the files to download, go to:\n https://github.com/ahupp/python-magic/blob/43df08c5ed63d7aad839695f311ca1be2eeb1ecb/README.md#dependencies\n\nUsage\n-----\n\nValidate single file\n~~~~~~~~~~~~~~~~~~~~\n\nThe field can be used in forms or model forms like a normal\n``FileField``. If a user tries to upload a file which is too large or\nwithout a valid type, a form validation error will occur.\n\nNote that the validation does not occur on the field itself (on\n``save()``), but when validated through a form.\n\nCreating form from model\n^^^^^^^^^^^^^^^^^^^^^^^^\n\nCreate a model and add a field of type ``ConstrainedFileField``. You can\nadd a maximum size in bytes and a list of valid mime types that will be\nallowed. The list of all mime types is available here:\nhttp://www.iana.org/assignments/media-types/index.html. Setting none of\nthe above, it behaves like a regular ``FileField``.\n\n::\n\n from django.db import models\n from constrainedfilefield.fields import ConstrainedFileField\n\n class TestModel(models.Model):\n the_file = ConstrainedFileField(\n null=True,\n blank=True,\n upload_to='testfile',\n content_types=['image/png'],\n max_upload_size=10240\n )\n\n::\n\n from django import forms\n from myproject.models import TestModel\n\n class TestModelForm(forms.ModelForm):\n class Meta:\n model = TestModel\n fields = ['the_file']\n\nBuilding a form\n^^^^^^^^^^^^^^^\n\n::\n\n from django import forms\n from constrainedfilefield.fields import ConstrainedFileField\n\n class TestNoModelForm(forms.Form):\n the_file = ConstrainedFileField(\n null=True,\n blank=True,\n upload_to='testfile',\n content_types=['image/png'],\n max_upload_size=10240\n ).formfield()\n\nJavascript file size validation\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nAdditionally, to prevent user uploading too large files, a javascript\nchecker can be set to the form field. In order to achieve that, you need\nto\n\n1. Add ``constrainedfilefield`` to the ``INSTALLED_APPS``. This will\n load the javascripts from the static files.\n2. Activate this feature by setting ``js_checker=True`` when\n instantiating the ``ConstrainedFileField``.\n3. Include the javascript in the template where the form field is used\n\n .. code:: Django\n\n {% load static %}\n \n\nValidate single image\n~~~~~~~~~~~~~~~~~~~~~\n\nSame as above, using ``ConstrainedImageFileField`` instead.\n\nThe ``ConstrainedImageField`` offers additional constraints: \\*\n``[min|max]_upload_[width|height]`` to define min/max dimensions,\nrespectively width and height.\n\nNote on DOS attacks\n-------------------\n\nImportant note: the check of the file size is made by Django once the\nwhole file has been uploaded to the server and stored in a temp\ndirectory (or in memory if the file is small). Thus, this is useful to\nguarantee the quota of the users, for example, but will not stop an\nattacking user that wants to block the server by sending huge files (e.\ng. of several Gb).\n\nTo avoid this, you need to configure your front end to limit the size of\nuploaded files. How to do it depends on the software you are using. For\nexample, if you use apache, you should use\n`**LimitRequestBody** `__\ndirective.\n\nThis is a complementary measure, because you'll usually want normal\nusers that exceed the size by a reasonable amount to get a friendly form\nvalidation message, while attacking users will see how their connection\nis abruptly cut before the file finishes uploading. So the recommended\nsetting is to give ``max_upload_size`` a small value (e.g. 5Mb) and\n``LimitRequestBody`` a higher one (e.g. 100Mb).\n\nCredits\n-------\n\nThis is a fork of\n`django-validated-file `__\nfrom `Kaleidos `__.\n\n.. |Python| image:: https://img.shields.io/badge/Python-2.7,3.4,3.5,3.6-blue.svg?style=flat-square\n :target: /\n.. |Django| image:: https://img.shields.io/badge/Django-1.8,1.9,1.10,1.11,2.0-blue.svg?style=flat-square\n :target: /\n.. |License| image:: https://img.shields.io/badge/License-BSD--3--Clause-blue.svg?style=flat-square\n :target: /LICENSE\n.. |PyPIv| image:: https://img.shields.io/pypi/v/django-constrainedfilefield.svg?style=flat-square\n :target: https://pypi.org/project/django-constrainedfilefield\n.. |PyPIs| image:: https://img.shields.io/pypi/status/django-constrainedfilefield.svg\n :target: https://pypi.org/project/django-constrainedfilefield\n.. |Build Status| image:: https://travis-ci.org/mbourqui/django-constrainedfilefield.svg?branch=master\n :target: https://travis-ci.org/mbourqui/django-constrainedfilefield\n.. |Coverage Status| image:: https://coveralls.io/repos/github/mbourqui/django-constrainedfilefield/badge.svg\n :target: https://coveralls.io/github/mbourqui/django-constrainedfilefield\n\n\n",
"description_content_type": "",
"docs_url": null,
"download_url": "https://github.com/mbourqui/django-constrainedfilefield/releases/tag/v3.2.0",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://github.com/mbourqui/django-constrainedfilefield/",
"keywords": "django filefield validation file",
"license": "BSD",
"maintainer": "",
"maintainer_email": "",
"name": "django-constrainedfilefield",
"package_url": "https://pypi.org/project/django-constrainedfilefield/",
"platform": "",
"project_url": "https://pypi.org/project/django-constrainedfilefield/",
"project_urls": {
"Download": "https://github.com/mbourqui/django-constrainedfilefield/releases/tag/v3.2.0",
"Homepage": "https://github.com/mbourqui/django-constrainedfilefield/"
},
"release_url": "https://pypi.org/project/django-constrainedfilefield/3.2.0/",
"requires_dist": [
"django (<2.0,>=1.8); python_version <= \"3.0\"",
"django (>=1.8); python_version >= \"3.4\"",
"Pillow (>=4.0.0); extra == 'coverage'",
"python-magic (>=0.4.2); platform_system != \"Windows\" and extra == 'coverage'",
"python-magic-bin; platform_system == \"Windows\" and extra == 'coverage'",
"python-magic (>=0.4.2); platform_system != \"Windows\" and extra == 'filetype'",
"python-magic-bin; platform_system == \"Windows\" and extra == 'filetype'",
"Pillow (>=4.0.0); extra == 'image'"
],
"requires_python": "",
"summary": "This Django app adds a new field type, ConstrainedFileField, that has the capability of checking the document size and type.",
"version": "3.2.0"
},
"last_serial": 3832431,
"releases": {
"3.0.6": [
{
"comment_text": "",
"digests": {
"md5": "0d4c5bc451696a4e22d7f0b28b305ede",
"sha256": "8904448d0902754cfee0c07db702e00f29d03204bd1fcdb62ed3c262a941b8dd"
},
"downloads": -1,
"filename": "django_constrainedfilefield-3.0.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0d4c5bc451696a4e22d7f0b28b305ede",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 19713,
"upload_time": "2017-05-15T15:59:37",
"url": "https://files.pythonhosted.org/packages/77/c1/1ed46efcf6d8bdd23da0b9265363dc22b5e90390858d40c045e7c47721b5/django_constrainedfilefield-3.0.6-py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "5e119429156f84f2f532acb1d97114f3",
"sha256": "08ced8dfd130944f29decf887f4f605e83ae53a399586e937908d0d0c539f797"
},
"downloads": -1,
"filename": "django-constrainedfilefield-3.0.6.tar.gz",
"has_sig": false,
"md5_digest": "5e119429156f84f2f532acb1d97114f3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 14218,
"upload_time": "2017-05-15T15:59:38",
"url": "https://files.pythonhosted.org/packages/e5/9b/b34fb1e51654db48830da39b8201314ecea1e2aa164d07039206dccdf351/django-constrainedfilefield-3.0.6.tar.gz"
}
],
"3.0.7": [
{
"comment_text": "",
"digests": {
"md5": "b2729a2c9bc3da9bf05fc4174800166d",
"sha256": "d78ac0fe770cc5494648a3aa3b30ed7092ae3dd2ef57a41533734d3595bbaab5"
},
"downloads": -1,
"filename": "django_constrainedfilefield-3.0.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b2729a2c9bc3da9bf05fc4174800166d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 19943,
"upload_time": "2017-08-16T14:00:53",
"url": "https://files.pythonhosted.org/packages/eb/d7/8bcc9ce8890acbede046281253c2955e05b7607cd94236157d111d68da14/django_constrainedfilefield-3.0.7-py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "67b8160a3a28b76440e3898e470f7312",
"sha256": "00cc51febabdb2bc470972f458391152e2da3483a6277825aa11eaac68a7b3bb"
},
"downloads": -1,
"filename": "django-constrainedfilefield-3.0.7.tar.gz",
"has_sig": false,
"md5_digest": "67b8160a3a28b76440e3898e470f7312",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 14552,
"upload_time": "2017-08-16T14:00:54",
"url": "https://files.pythonhosted.org/packages/64/e0/3a07e01c6465c8e40e88714423817c3cc459a62fbed6948546ae4c17aacc/django-constrainedfilefield-3.0.7.tar.gz"
}
],
"3.1.0": [
{
"comment_text": "",
"digests": {
"md5": "67addb7dd184a261cc7e65d74772db52",
"sha256": "69152d9a5168a48dd8b3c1e6171dfe109c38164baf6563b9a776324006263b7c"
},
"downloads": -1,
"filename": "django_constrainedfilefield-3.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "67addb7dd184a261cc7e65d74772db52",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 19539,
"upload_time": "2017-12-24T17:08:46",
"url": "https://files.pythonhosted.org/packages/8f/15/721042b27bb3ca0850b81ffff9cf4783923316acd6881112903b94ed9f5b/django_constrainedfilefield-3.1.0-py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "3736eadfad6b9cc3b8bcdd79eb6e7513",
"sha256": "5e5fdfb3f54f0097a20723eda84399c741a2d503ffbdeda3e3c01e5379f0e5d1"
},
"downloads": -1,
"filename": "django-constrainedfilefield-3.1.0.tar.gz",
"has_sig": false,
"md5_digest": "3736eadfad6b9cc3b8bcdd79eb6e7513",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 12652,
"upload_time": "2017-12-24T17:08:47",
"url": "https://files.pythonhosted.org/packages/2a/f5/2a204a4f63fd7a640869ff3cd7b4d49c85dcb6a1a4bcb8bc3bdc1e04817b/django-constrainedfilefield-3.1.0.tar.gz"
}
],
"3.1.3": [
{
"comment_text": "",
"digests": {
"md5": "fce8da57444b3c554519b2ad91b93d96",
"sha256": "4bae53745a97576cb526400d61698cb7bdf75b73af1350c4f854dc36855449f3"
},
"downloads": -1,
"filename": "django_constrainedfilefield-3.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fce8da57444b3c554519b2ad91b93d96",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 20193,
"upload_time": "2018-01-02T17:09:35",
"url": "https://files.pythonhosted.org/packages/fe/de/823861a3f15d8776d5ff3fff56cceb8aaea12b0db65187bf5d490b3fdc71/django_constrainedfilefield-3.1.3-py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "ad985f22f410e85f12e944309936e8ec",
"sha256": "4d4d5e4a4e7b2d0323cc99622d21ebc63ab2888be2d457653169dec8b6163e6d"
},
"downloads": -1,
"filename": "django-constrainedfilefield-3.1.3.tar.gz",
"has_sig": false,
"md5_digest": "ad985f22f410e85f12e944309936e8ec",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 13126,
"upload_time": "2018-01-02T17:09:37",
"url": "https://files.pythonhosted.org/packages/10/19/e8126da4d53082abca03ff71344e6b960b195beae96d7900333167d7ead7/django-constrainedfilefield-3.1.3.tar.gz"
}
],
"3.2.0": [
{
"comment_text": "",
"digests": {
"md5": "a8bfdfafaa539bbfb66d2b66e9194f33",
"sha256": "a5f442a739c39a4ff15de4857436fb3a9edf2cc16c97be42228cd2c4e2024eff"
},
"downloads": -1,
"filename": "django_constrainedfilefield-3.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a8bfdfafaa539bbfb66d2b66e9194f33",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 23848,
"upload_time": "2018-05-03T21:00:58",
"url": "https://files.pythonhosted.org/packages/41/96/46f515c9f258e3244dc1658fd2e5261c9f5060ac9fb34cc3b6f32e65cfd3/django_constrainedfilefield-3.2.0-py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "95010052eabfc3f8296497e810ca09a6",
"sha256": "1e151a3dae2b545224127f2177ee5075ecfe0d75a65634df8715cd5b4a799756"
},
"downloads": -1,
"filename": "django-constrainedfilefield-3.2.0.tar.gz",
"has_sig": false,
"md5_digest": "95010052eabfc3f8296497e810ca09a6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 15002,
"upload_time": "2018-05-03T21:00:59",
"url": "https://files.pythonhosted.org/packages/a9/33/7e658813cc0a6d87b1c93e588a5070d90b1424920b3f96b977a7a9a9760f/django-constrainedfilefield-3.2.0.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "a8bfdfafaa539bbfb66d2b66e9194f33",
"sha256": "a5f442a739c39a4ff15de4857436fb3a9edf2cc16c97be42228cd2c4e2024eff"
},
"downloads": -1,
"filename": "django_constrainedfilefield-3.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a8bfdfafaa539bbfb66d2b66e9194f33",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 23848,
"upload_time": "2018-05-03T21:00:58",
"url": "https://files.pythonhosted.org/packages/41/96/46f515c9f258e3244dc1658fd2e5261c9f5060ac9fb34cc3b6f32e65cfd3/django_constrainedfilefield-3.2.0-py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "95010052eabfc3f8296497e810ca09a6",
"sha256": "1e151a3dae2b545224127f2177ee5075ecfe0d75a65634df8715cd5b4a799756"
},
"downloads": -1,
"filename": "django-constrainedfilefield-3.2.0.tar.gz",
"has_sig": false,
"md5_digest": "95010052eabfc3f8296497e810ca09a6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 15002,
"upload_time": "2018-05-03T21:00:59",
"url": "https://files.pythonhosted.org/packages/a9/33/7e658813cc0a6d87b1c93e588a5070d90b1424920b3f96b977a7a9a9760f/django-constrainedfilefield-3.2.0.tar.gz"
}
]
}