django-attachments icon indicating copy to clipboard operation
django-attachments copied to clipboard

Add model method that gives path to file with MEDIA_DIR prepended.

Open flowl opened this issue 5 years ago • 2 comments

Images get uploaded to

STATIC_DIR + /attachments/module_entity/73630/image.jpg

But when getting displayed, the static/media prefix is not respected and it loads the image from

attachments/module_entity/73630/image.jpg => 404

Sidequestion: Is there a variable to configure to use the current logged in user instead of presenting a selectbox to chose the upload user from?

flowl avatar Jun 25 '19 14:06 flowl

STATIC_DIR looks wrong, it should land in your MEDIA_DIR. Currently you need to prepend the MEDIA_URL manually. So something along

<a href="/uploads/{{ att.attachment_file.url }}"...

bartTC avatar Jun 25 '19 15:06 bartTC

Is there a variable to configure to use the current logged in user instead of presenting a selectbox to chose the upload user from?

You mean in the admin integration? No. The admin part is primarily for maintanance, not intended to have regular users/editors add files through it. If thats your only entry point then you probably don't need this app and can build it on your own.

Overriding the admin and having it behave that way is not that complicated though.

bartTC avatar Jun 25 '19 15:06 bartTC