Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More than just admin widget integration? #6

Open
mrmachine opened this issue Feb 8, 2016 · 2 comments
Open

More than just admin widget integration? #6

mrmachine opened this issue Feb 8, 2016 · 2 comments

Comments

@mrmachine
Copy link

I'd like to create a new file/image library app that does more than just provide a browser and enhanced admin form widgets for file/image selection and upload.

I'd like the library to store additional metadata like alt text, cache file size (useful when using S3 storage backend and querying file size on a list of files is slow) and type, etc.

I'd like to either contribute, an integration class to django-any-imagefield or for django-any-imagefield to have some better hooks that would allow me to use a private integration class (e.g. import the backend class from a setting).

My image/file library would use a storage name field as its primary key, and provide a descriptor on the resulting FieldFile object that is returned when you access foo.my_file_field, that would lookup the corresponding metadata from the library via foo.my_file_field.name.

I just wanted to check in with you if this sounds feasible and worthwhile, and if you could point out any likely pitfalls I might encounter?

@mrmachine
Copy link
Author

To clarify, that would be a single descriptor on my AnyFileField backend class, called metadata or library, that would lookup the corresponding object from the library, so I could do things like foo.my_file_field.metadata.size, foo.my_image_field.metadata.alt_text, etc.

@vdboor
Copy link
Member

vdboor commented Mar 8, 2016

Hi,

Yes, adding a new library that uses foreign keys is no problem at all. We've added django-filer support too. It does mean through that new projects should choose the file browser type beforehand, much like AUTH_USER_MODEL because it affects initial migrations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants