I have a model:
class Example(models.Model):
unique_hash = models.CharField(max_length=32,unique=True)
content = models.FileField(upload_to='source',blank=True,verbose_name="HTML Content File")
I would like to be able to set the content filename to default to a callable, but I don’t see any way to have the callable reference unique_hash (or vice versa). Is this possible?
If you mean that callable should generate filename, I’m not aware of that.
You can, however, use custom storage (see docs, subclass
django.core.files.storage.FileSystemStorage) that will provide custom algorithm for filename generation.