Skip to main content
Help the Python Software Foundation raise $60,000 USD by December 31st!  Building the PSF Q4 Fundraiser

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


Download files

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

Files for dynamic-upload-image-field, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size dynamic_upload_image_field-0.1.2-py3-none-any.whl (2.6 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size dynamic_upload_image_field-0.1.2.tar.gz (6.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page