Skip to main content

A django ImageField whose upload_to value is generated from a model method

Project description

Django Dynamic Image


A django ImageField whose upload_to value is generated from a model method.


pip install django-dynamic-image


from django.db import models
from dynamic_image.fields import DynamicImageField

class ExampleModel(models.Model):
    name = models.CharField(max_length=56)
    image = DynamicImageField()

    def get_upload_to(self, field_name):
        class_name = self.__class__.__name__.lower()
        instance_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 django-dynamic-image, version 1.4.0
Filename, size File type Python version Upload date Hashes
Filename, size django_dynamic_image-1.4.0-py3-none-any.whl (6.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size django-dynamic-image-1.4.0.tar.gz (4.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page