|leading_zeros:"5" }}' for each document type. The renaming will be connected to the documents.signals.post_document_created signal so that it happens only once and not for each document version. If you have a GitLab account I can create the app repository and initial code in the Mayan EDMS GitLab group. Development chapters for reference: http://mayan.readthedocs.org/en/latest/topics/app_creation.html and http://mayan.readthedocs.org/en/latest/topics/development.htmlHello,
I've pushed initial code to implement this as a separate app here: https://gitlab.com/mayan-edms/document_renaming. Separate sequences can be created with different increments. Renaming templates are then created which reference existing sequences. A renaming template is associated with a document type. Everytime a new document is uploaded the renaming template is rendered and the result is applied a the label for the new documents. Still missing: Locking to avoid repeated sequence numbers and proper setup views. If you can provide a GitLab account I will add developer permissions for it for the repository.
In your settings/local.py file add document_renaming to your INSTALLED_APPS list:
INSTALLED_APPS += (
'document_renaming',
)Should that actually read mayan/settings/base.py? I have added the application to the base.py file and run migrations. However, I still don't see this application added in the admin dashboard.
Rachael
INSTALLED_APPS += (
'document_renaming',
)INSTALLED_APPS += ( 'document_renaming', )
--
---
You received this message because you are subscribed to a topic in the Google Groups "Mayan EDMS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mayan-edms/HRy_us-jp10/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mayan-edms+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
from jinja2 import Template
from document_renaming.models import Sequence
document=Document.objects.first()
Template('{% set user = document.target_actions.first().actor %}{{user}}-{{ Sequence.objects.get(slug=user).next_value() }}').render(document=document, Sequence=Sequence)
{% set username = document.target_actions.first().actor.username %}{{ username }}-{{ "%05d"|format(Sequence.objects.get_or_create(slug=username,label=username)[0].next_value()) }}Hi Roberto,I’m still a little confused. Do I add the following to the document_renaming model or the document model?from jinja2 import Template
from document_renaming.models import Sequence
document=Document.objects.first()Did you add the following code as the renaming template via the web interface:Template('{% set user = document.target_actions.first().actor %}{{user}}-{{ Sequence.objects.get(slug=user).next_value() }}').render(document=document, Sequence=Sequence)Kind regards,Rachael
To unsubscribe from this group and all its topics, send an email to mayan-edms+unsubscribe@googlegroups.com.