Beginner's question to get an "unpaid bills" index

Questions, comments, discussions. Over time certain topics might be moved to their own category.
Post Reply
hhz
Posts: 7
Joined: Mon Oct 26, 2020 9:31 pm

Beginner's question to get an "unpaid bills" index

Post by hhz »

Hi there,

I'm trying to set up Mayan for my personal paperwork. Currently, I have a document type "invoice" and a document type "medical invoice". Both can be tagged as "paid", medical invoices can also be tagged as "submitted" for coverage by the insurance company.

Now I want an index that shows me all invoices and medical invoices that are not yet tagged as "paid".

However, I can't get this to work.

Code: Select all

{% if "paid" not in document.tags.all %}Unpaid{% endif %} 
Won't work because "paid" is the label of the tag, not the tag itself.

Also, is there a place where I can see my templating syntax errors? Couldn't find an error log that showed me if my index template was wrong.

Thanks!
hhz
Posts: 7
Joined: Mon Oct 26, 2020 9:31 pm

Re: Beginner's question to get an "unpaid bills" index

Post by hhz »

Ok, was able to solve this with

Code: Select all

{% if not "paid" in document.tags.all|join:" " %}Unpaid{% endif %} 
but I'm not perfectly understanding this. Why can you join the tags.all array and it returns the joined labels, while you can't find the label in the array with the "value in array" notation?
james
Posts: 10
Joined: Fri Jan 08, 2021 6:15 pm

Re: Beginner's question to get an "unpaid bills" index

Post by james »

A quick test in the sandbox shows:

Code: Select all

{{ document.tags.all}}
<QuerySet [<Tag: test_tag>]>


{{ document.tags.all|join:"  " }}
test_tag
so the join converts the result into text. Maybe the "in" cannot work on QuerySets?

The examples at https://docs.mayan-edms.com/chapters/in ... mples.html all use joins for the "in"s
Post Reply