I'm currently working on Django for a website on a legacy database but I'm facing an issue on getting ImageField working with it in the admin.
In the database images are stored as a simple file name, because they have several size precomputed on different directories.
So basically, I need to:
- save the filename - and only the filename - the database
- save the file to a given location and resize it to different size
I tried different ways to get this working but none did work in order to get the correct filename in the database.
First I edited the ImageField.name when model is saved but the name gets overwritten when saving the model.
Then I gave the build-in filesystem storage but it didn't work better.
http://docs.djangoproject.com/en/1.1/topics/files/#the-built-in-filesystem-storage-class doesn't mention you need upload_to
However, whenever upload_to is set, it overrides the storage location which seems to contradict ticket #8918.
Has someone already solved a similar issue ?
Xavier.
http://code.google.com/p/django-googledata/
Thanos
On Mar 2, 4:44 am, Xavier Ordoquy <xordo...@linovia.com> wrote:
> Hi,
>
> I'm currently working on Django for a website on a legacy database but I'm facing an issue on getting ImageField working with it in the admin.
>
> In the database images are stored as a simple file name, because they have several size precomputed on different directories.
> So basically, I need to:
> - save the filename - and only the filename - the database
> - save the file to a given location and resize it to different size
>
> I tried different ways to get this working but none did work in order to get the correct filename in the database.
>
> First I edited the ImageField.name when model is saved but the name gets overwritten when saving the model.
>
> Then I gave the build-in filesystem storage but it didn't work better.http://docs.djangoproject.com/en/1.1/topics/files/#the-built-in-files...doesn't mention you need upload_to