Yes, I was wondering how to do that because it's not at all obvious. However I have since decided that I simply need a custom Storage class like this:
class ChecksumStorage(FileSystemStorage):
"""Store files in the file system with filename based on file contents."""
def save(self, name, content, max_length=None):
checksum = hashlib.sha256()
for data in content.chunks():
checksum.update(data)
return super().save(checksum.hexdigest(), content)
and then I don't need a model at all, I can just refer to the files with a CharField(max_length=64).