folder viewer with permission

hi
i have project in django, i want to give users, button to click
when click, it gives folder content images, pdf, and excel
how to make template to view this type of files
with permission of users to view only, download

i will apreciate any idea
thanks

You could create a view to get the directory listing, then in your template you would render that list however you want. You could define elements of that list as an <a ...> tag to make them clickable in the browser.

thanks for your reply
i must add in model link of folder
after view add function listing file
in template what about viewer files : pdf, xls and images?
wich plugin or package i can add to django for that

thanks

I’m not following what you’re asking for here. What do you mean by “model link of folder”?

If you want some ideas or examples of how other people have done this, check out the file-managers grid on djangopackages.org.

sorry for my english
i mean in my model i must add field “link” of folder
thanks

Are you tracking this directory structure in a model, or are you reading the directories live when the page is requested? If the latter, there’s no model involved. You can use the Python pathlib module to get your directory listing, and then process it in your view as needed.

A “link” for a folder would be no different than a link for anything else. It’s just a URL reference that would call a view to render a different page. (In this case, the page would likely be a different directory listing.)

hi and thanks
i ll explore pathlib and try to get best result
what about viewer image, xls, and pdf? does pathlib or other module can do it?

thanks for all

Can you be more explicit here about what you’re asking for?

when i list content folder (with may content pdf, xls, and images)
when user click on each file it result a viewer of selected file

to resume, i have many studies, each one content documents pdf,images and xls, and are stored in volume shared network,
user search studies, locate one, and can read only the content of studies files.

thanks for all
thanks

Do you have any restrictions that need to be put in place as to who can see which files? If you need to apply any restrictions or limits on a per-user basis, this becomes a much more intricate issue.

If not, then about all you need to do is create an <a tag for each file to be displayed on the listing page.

of course, user with permissions to read only, or download
like filevista web filebrowser

thanks

First to be clear, if they can read it, they can download it. There’s no difference between the two.

But what I’m asking is whether or not different users would have access to different sets of files. In other words, are there files that you would see that I wouldn’t have access to?

thanks for your help
i am inspired from soft maked in asp (filevista), Web File Manager (Self-Hosted File Sharing, Own Cloud Storage) (gleamtech.com)

user with permissions can read only, not can download the file

thanks

There’s no distinction between the two. If you send a file to my browser for me to read it, I can save it locally. That’s not something you can manage from the server. That’s a difference between implementing something in a browser vs a custom client. When you write a custom client, you have complete control over what that client does. In the web environment, you don’t have any real control over the client.

thanks great for yours helps