I think the current FileField is nice for some use cases,
but for other use cases it is too complicated.
Example:
class MyProfile(models.Model):
picture = models.FileField()
If profile of user "foo" uses "foo.jpg" as picture,
and user "bar" uses "foo.jpg", too. Then
the profile picture of "bar" will overwrite the picture
of "foo.jpg".
I know that there are ways to work-around this.
But why not provide a more convenient way in future
releases of Django?
But maybe I am missing something.
Wouldn't it be nice, if there would be a nameless FileField?
I don't want to care about the name of the file. It can
be a uuid or other random data.
If you want to store some data like a blob, like BinaryField.
But, I don't want to store the blob in the
database, like BinaryField does. I would like to use a plugable storage.
Up to now you can't easily use FileField in create() or get_or_create().
It would be nice if you could use a nameless FileField like this:
MyProfile.objects.create(picture=b'binarydata...')
What do you think about this idea?
Is it worth talking to django-developers, or is there already a solution,
which I just do not know up to now?
Regards,
Thomas Güttler