v4.1 - Index show all document_types including trashed

If you want to help out with the project, this is the forum for you. Here you will find topics for which the team needs help or volunteers to take over.
Post Reply
gope
Posts: 4
Joined: Tue Oct 12, 2021 1:14 pm

v4.1 - Index show all document_types including trashed

Post by gope »

Hi,

I need to build an index that show all files by document type, including the trashed ones.
(To build a control version master file)
Is that possible on version 4.1?

{% if "_edit" not in document.label %} {{ document.document_type }} {% endif %}

This shows all files except the ones I explicitly indicated ("_edit"), but I need to include the trashed ones.

Thanks.
lanterieur
Posts: 19
Joined: Wed Aug 18, 2021 7:54 am

Re: v4.1 - Index show all document_types including trashed

Post by lanterieur »

I am not familiar with indexes.

If all you need is to check trash status, in Django template, you can access the trash status of a document through: `{{ document.in_trash }}`.

I know nothing about indexes, I am not sure on what data/queryset they are called. If the aforementioned .in_trash property does not do the job for you, consider looking at the python source.

I have fiddled around with Mayan EDMS source code to create additional API endpoints.
I encourage you to clone Mayan EDMS series/4.1 locally, follow the development deploy instructions (with virtual python env) and start playing around with query sets.

I suspect that by default most documents querysets will exclude trashed documents.
You may duplicate the documents list view and query documents directly (pseudo code getModel('documents').objects.all()). If you look at the model structure, trashed documents have a boolean "in_trash" set to true.

I am only a Mayan EDMS user and a beginner at that. Hope this helps.
gope
Posts: 4
Joined: Tue Oct 12, 2021 1:14 pm

Re: v4.1 - Index show all document_types including trashed

Post by gope »

Thanks for trying. :)

I'll have to check the code. It's just hard to justify the time spent on this..
Post Reply