Why isn't the filename property getting set on my FileField instance?

This code is creating and updating objects with empty filename attributes:

def _database_path(project, filename):
    return f'{project.id}/{filename}'

database = models.FileField(upload_to=_database_path,

The files are saved and retrieved without a problem, but the filename property is blank for this field. Why isn't this working (and what can I do to fix it)?

Back to Top