This package is a set of field and widget that improves the images and files field behaviour
Project description
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
Add it to your INSTALLED_APPS:
INSTALLED_APPS = (
...
'file_field_utils',
...
)
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-file-field-utils-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64e32dce97cfd67c4560022bb66445dc6d22c673011e48a6c03dff1c9eb16258 |
|
MD5 | 7fb2324f8006858e544b5262880a8f7c |
|
BLAKE2b-256 | 0aebe522e5ddfb8305103f9a37d5eb55f128343e5f15ac5e950e5f0c25550a12 |
Hashes for django_file_field_utils-0.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4cdefd232a3021a451dbcfbcc9ee82e22fa61c8d0f383789f2c0158ccd2ba9a7 |
|
MD5 | a2391e39afc93571046ce0dcdc9b4866 |
|
BLAKE2b-256 | 47105de8c13a55b95aa49b05bc723ea0e162d34b842a1cf141c73c55c24f01c9 |