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
Close
Hashes for dynamic_upload_image_field-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bbf7bb31d8bac6e420a53698abe000fa80bae82954659ef458840ae68a9efda5 |
|
MD5 | ac6bd34b26d9472fcc3aeddd001b7e64 |
|
BLAKE2b-256 | 591e9ac3dab5f5c1da144d2498be1be1183b6eb593008242c770bcfcc0cbb98e |
Close
Hashes for dynamic_upload_image_field-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7b456587b14cc68041e2da9e9c69a347dffea943d3f9cda8d91d8afb3f5ea49 |
|
MD5 | c0c3eb253ccd08a23fc0c40dbd8debd9 |
|
BLAKE2b-256 | 4dc36410fb8867bac460393eaf22d34097281fe97651975b34ea2b9ff07c97c7 |