Skip to main content

This package is a set of field and widget that improves the images and files field behaviour

Project description

https://badge.fury.io/py/django-file-field-utils.svg/?style=flat-square https://readthedocs.org/projects/pip/badge/?version=latest&style=flat-square Coverage Status

This package is a set of field and widget that improves the images and files field behaviour

Documentation

The full documentation is at https://django-file-field-utils.readthedocs.io.

Quickstart

Install Django File Field Utils:

pip install django-file-field-utils

You need to add easy_thumbnails to INSTALLED_APPS:

INSTALLED_APPS = (
    ...
    'easy_thumbnails',
    ...
)

Run

python manage.py migrate easy_thumbnails

Features

  • A image-field that support also svg files

Example of usage

image = SVGAndImageField(_("Image"), blank=True)
  • An admin widget that get the preview of image-field

Example of usage

from file_field_utils.db.widgets import ConfigurableImageWidget

class NewsAdminForm(forms.ModelForm):
    class Meta:
        model = News
        widgets = {
            'image': ConfigurableImageWidget()
        }

@admin.register(News)
class NewsAdmin(admin.ModelAdmin):
    form = NewsAdminForm
  • Method for media file upload path support in file fields

Example of usage

image = ImageField(_("Image"), upload_to=UploadPath("example"), blank=True)
The image of model instance will be upload under directory:

/media/uploads/<instance_model_app_label>/<instance_model_name>/example/

image = ImageField(_("Image"), upload_to=UploadPathWithID("example"), blank=True)
The image of model instance will be upload under directory:

/media/uploads/<instance_model_app_label>/<instance_model_name>/example/<instance_id>/

Running Tests

Does the code actually work?

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install tox
(myenv) $ tox

Development commands

pip install -r requirements_dev.txt
invoke -l

Credits

Tools used in rendering this package:

History

0.1.0 (2022-01-17)

  • First release on PyPI.


0.1.1 (2022-01-24)


0.1.2 (2022-01-24)


0.1.5 (2022-01-24)

  • Update requirements and readme.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-file-field-utils-0.1.5.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_file_field_utils-0.1.5-py2.py3-none-any.whl (10.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file django-file-field-utils-0.1.5.tar.gz.

File metadata

  • Download URL: django-file-field-utils-0.1.5.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10

File hashes

Hashes for django-file-field-utils-0.1.5.tar.gz
Algorithm Hash digest
SHA256 695d907be555b461ece8d28015f231096dc1d490b2aff0d5cc186662a657330c
MD5 a879f9566478e5e81977b173a28b733e
BLAKE2b-256 12d83aa9cb0894f9d356056e9d15d3275eb2a3fac288d5602bd730140b4342af

See more details on using hashes here.

File details

Details for the file django_file_field_utils-0.1.5-py2.py3-none-any.whl.

File metadata

  • Download URL: django_file_field_utils-0.1.5-py2.py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.10

File hashes

Hashes for django_file_field_utils-0.1.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3844b3f3cce4a67cf7ca1b693816fdbb082c2e3a64fa1bd6d0e5f1a6cdddb010
MD5 1e017ea1416c9b6016b3c4ba0f665d6c
BLAKE2b-256 480e5d7e000fa33726dd545389d60babf48a7b082f657a337ba199109187def4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page