Skip to content

Dynamically set variations for a StdImageField #254

@baxeico

Description

@baxeico

This is a question and not an issue. Hope that this is the right place to ask. :)

Imagine a model like this.

class MovieImage(TimeStampedModel):
    IMAGE_TYPE_CHOICES = Choices('logo', 'cover')
    movie = models.ForeignKey(Movie, related_name='images', on_delete=models.CASCADE)
    image = StdImageField(upload_to='movies/', max_length=100)
    image_type = models.CharField(choices=IMAGE_TYPE_CHOICES, max_length=30, blank=True)

I would like to have different variations basing on image_type. Could the variation attribute be specified at runtime, e.g. on a Django view?

Thank you very much for your help and keep up the good work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions