A django ImageField that generates it's upload_to value from the model instance method get_upload_to.
Project description
Dynamic Upload Image Field
Description
A django ImageField that generates it's upload_to value from the model instance method get_upload_to.
Installation
pip install dynamic-upload-image-field
or
pipenv install dynamic-upload-image-field
Usage
from django.db import models
from dynamic_upload_image_field.fields import DynamicUploadImageField
class ExampleModel(models.Model):
name = models.CharField(max_length=56)
image = DynamicUploadImageField()
def get_upload_to(self, field_name):
class_name = self.__class__.__name__.lower()
instance_name = self.name
return "{}/{}".format(class_name, instance_name)
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
File details
Details for the file dynamic_upload_image_field-0.1.2.tar.gz
.
File metadata
- Download URL: dynamic_upload_image_field-0.1.2.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa9e27fe343becfafd966ce0ce45a4f0ffb9e94b2b997392595558a858ca9032 |
|
MD5 | 38f28de1a6042f331710f2816ef600f0 |
|
BLAKE2b-256 | c13852e56feff7ec2dcdedcb02ad0a3f47d6f2227290418087466875b68aac73 |
File details
Details for the file dynamic_upload_image_field-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: dynamic_upload_image_field-0.1.2-py3-none-any.whl
- Upload date:
- Size: 2.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb7ec3e1a2e2c64bcbf85524c7afac62eda8ee8151f221544c5c951c40a16872 |
|
MD5 | 25cc0b5096d4c3f79a465874175d2fab |
|
BLAKE2b-256 | 166b888f029a8e719935295fdcd01aaf2c071ed4e96305510c52ff62463437ac |