That is correct. Metadata values are just strings. The date filter expects a DateTime value (https://docs.djangoproject.com/en/1.7/ref/templates/builtins/#date)
If you want to go with the custom filter route this is the corresponding Django documentation chapter: https://docs.djangoproject.com/en/1.7/howto/custom-template-tags/ To parse date and times I would suggest using Python Dateutil (https://pypi.python.org/pypi/python-dateutil) supports many input formats and is used by the metadata validators and parsers (https://gitlab.com/mayan-edms/mayan-edms/blob/master/mayan/apps/metadata/parsers.py) On Monday, January 25, 2016 at 12:37:57 PM UTC-4, Mabcde Labcde wrote: > > Hi Luke, > problem is that all the metadata is stored as string, so date_paid is a > string and cannot formated with the django-template "date" format function. > > I found a quick workaround: {{ document.metadata_value_of.Doc_Datum | > slice:":7" }} > > The best solution would be to write an custom template tag which converts > the string to date. Google helps ... > > br > Matthias > > Am Sonntag, 24. Januar 2016 12:31:43 UTC+1 schrieb Luke Wilmen: >> >> Hi, >> I'm a relatively new Mayan-EDMS user and must say I'm very impressed by >> the software thus far. >> >> Reading the docs, I can see that there has been a change in 2.0.0 to the >> Django templating engine. I'm trying to create a node that lists the years >> in the index from a metadata attribute of "date_paid" for invoices/receipts. >> >> As such, I'm using the following expression: >> >> {{ document.metadata_value_of.date_paid|date:"Y" }} >> >> This is failing to match any documents, however I can confirm that if no >> operator is used after date_paid, it will show a list of all dates of >> receipts. I want to group these by year. >> >> Then after this - I'd like to group by financial year (Australian financial >> year Jul 2015 - Jun 2016). >> >> Thank you for your time - and your assistance is most appreciated. >> >> Kind regards, >> Luke. >> >> -- --- You received this message because you are subscribed to the Google Groups "Mayan EDMS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
