django-webpfield


Namedjango-webpfield JSON
Version 0.1.0 PyPI version JSON
download
home_page
SummaryA simple library that convert any user uploaded images to webP format
upload_time2023-12-26 17:32:54
maintainer
docs_urlNone
author
requires_python>=3.11
licenseThe MIT License (MIT) Copyright (c) 2014 WGBH Educational Foundation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords django webp
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            =============================
Welcome to Django WebP Field
=============================

This is a library for Django that provides a custom model field for storing WebP images.
The `WebPField` model field allows you to store WebP images in your Django models
and provides convenient methods for converting between WebP and other image formats.

Installation
------------

To install the library, simply add it to your project's dependencies using pip:

.. code-block:: bash

    pip install django-webpfield

Usage
-----

To use the `WebPField` model field, simply import it from the library and add it to your Django model:

.. code-block:: python

    from django.db import models
    from webpfield.fields import WebPField


    class MyModel(models.Model):
        my_image = WebPField(upload_to="images/")


Settings
--------
The default settings are:

.. code-block:: python

    WEBP_FIELD_SETTINGS = {
        "saving_kwargs": {
            "quality": 75,
            "lossless": False,
        },
        "delete_original": False,
        "enable_svg": True,
        "image_field_class": {"module": "django.db.models", "class_name": "ImageField"},
    }

- saving_kwargs: are the kwargs passed to pillow when saving the new image
- enable_svg: if True you can upload and svg and it will remain svg as original, this achieved by updating the formfield kwargs of WebPField to file field instead of image field
- image_field_class: The default parent class of WebPField is django ImageField, but you can override it with yours

Contributing
------------

Contributions to the library are welcome! If you find a bug, have a feature request, or would like to contribute code,
please open an issue or pull request on the GitHub repo.

License
-------

This library is licensed under the MIT license. See the LICENSE file for more information.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "django-webpfield",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": "",
    "keywords": "django,webp",
    "author": "",
    "author_email": "Ahmed Elhakim <ahmed.w.elhakim@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/84/01/474a8fe30f9893d58a3b916e552e42cb45e551cfef667e07d172789c5142/django_webpfield-0.1.0.tar.gz",
    "platform": null,
    "description": "=============================\nWelcome to Django WebP Field\n=============================\n\nThis is a library for Django that provides a custom model field for storing WebP images.\nThe `WebPField` model field allows you to store WebP images in your Django models\nand provides convenient methods for converting between WebP and other image formats.\n\nInstallation\n------------\n\nTo install the library, simply add it to your project's dependencies using pip:\n\n.. code-block:: bash\n\n    pip install django-webpfield\n\nUsage\n-----\n\nTo use the `WebPField` model field, simply import it from the library and add it to your Django model:\n\n.. code-block:: python\n\n    from django.db import models\n    from webpfield.fields import WebPField\n\n\n    class MyModel(models.Model):\n        my_image = WebPField(upload_to=\"images/\")\n\n\nSettings\n--------\nThe default settings are:\n\n.. code-block:: python\n\n    WEBP_FIELD_SETTINGS = {\n        \"saving_kwargs\": {\n            \"quality\": 75,\n            \"lossless\": False,\n        },\n        \"delete_original\": False,\n        \"enable_svg\": True,\n        \"image_field_class\": {\"module\": \"django.db.models\", \"class_name\": \"ImageField\"},\n    }\n\n- saving_kwargs: are the kwargs passed to pillow when saving the new image\n- enable_svg: if True you can upload and svg and it will remain svg as original, this achieved by updating the formfield kwargs of WebPField to file field instead of image field\n- image_field_class: The default parent class of WebPField is django ImageField, but you can override it with yours\n\nContributing\n------------\n\nContributions to the library are welcome! If you find a bug, have a feature request, or would like to contribute code,\nplease open an issue or pull request on the GitHub repo.\n\nLicense\n-------\n\nThis library is licensed under the MIT license. See the LICENSE file for more information.\n",
    "bugtrack_url": null,
    "license": "The MIT License (MIT)  Copyright (c) 2014 WGBH Educational Foundation  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "A simple library that convert any user uploaded images to webP format",
    "version": "0.1.0",
    "project_urls": {
        "github": "https://github.com/ahmedwelhakim/django-webpfield/"
    },
    "split_keywords": [
        "django",
        "webp"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "72f60d11169fb72263211d1f91aed3124a66149069558dadae1f17e1719f911e",
                "md5": "d97c1da79e883ef56b7914ad627e2590",
                "sha256": "f2b77113e0d844251ffa3f71a3f560b6bf3a87f8bbecfe39c5ab9c1bc3cfc124"
            },
            "downloads": -1,
            "filename": "django_webpfield-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d97c1da79e883ef56b7914ad627e2590",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 6330,
            "upload_time": "2023-12-26T17:32:52",
            "upload_time_iso_8601": "2023-12-26T17:32:52.474599Z",
            "url": "https://files.pythonhosted.org/packages/72/f6/0d11169fb72263211d1f91aed3124a66149069558dadae1f17e1719f911e/django_webpfield-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8401474a8fe30f9893d58a3b916e552e42cb45e551cfef667e07d172789c5142",
                "md5": "25778ba253d9d34dfeab7b6e850cfb8a",
                "sha256": "99006b95b502057f821c64a29b31f229b648d2207f4fcc82991428dbbb61ddae"
            },
            "downloads": -1,
            "filename": "django_webpfield-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "25778ba253d9d34dfeab7b6e850cfb8a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 116981,
            "upload_time": "2023-12-26T17:32:54",
            "upload_time_iso_8601": "2023-12-26T17:32:54.104956Z",
            "url": "https://files.pythonhosted.org/packages/84/01/474a8fe30f9893d58a3b916e552e42cb45e551cfef667e07d172789c5142/django_webpfield-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-26 17:32:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ahmedwelhakim",
    "github_project": "django-webpfield",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "django-webpfield"
}
        
Elapsed time: 0.16124s