Thank you Roberto, and count on that! Tonight I'll start adding my app, and recording the steps I give in order to generate a documentation on the topic.
Regards, On Monday, April 6, 2015 at 4:11:28 AM UTC-3, Roberto Rosario wrote: > > Hi Magan, > > Indeed there is no documentation on the topic. I've added a ticket to > remedy that (https://github.com/mayan-edms/mayan-edms/issues/175). In the > mean this is the rough idea: > > This is for Mayan 1.1, for Mayan 2.0 some the steps have already changed. > > 1. Create a directory inside mayan/apps for your new app. > 2. Create an empty __init__.py and a models.py file with the line: > > from django.db import models > > this is so Django recognizes this directory as a valid Django app. > > 3. Tie your code to the post_version_upload signal by adding this to the > models.py file of your app, this signal fires when a document received a > new version or a new document is uploaded: > > from django.dispatch import receiver > from documents.signals import post_version_upload > from documents.models import DocumentVersion > > @receiver(post_version_upload, dispatch_uid=my_new_doc_handler', sender > =DocumentVersion) > def my_new_doc_handler(sender, instance, **kwargs): > print 'new document version', instance > print 'new document', instance.document > > 4. To register a view, create a normal views.py, urls.py. Then create a > file named links.py and add a dictionary for every link you want to add: > > link_my_app_link = {'text': _('Document summary'), 'view': 'myapp:my_view'} > > 5. In you __init__.py file add: > > from navigation.api import register_top_menu > from .links import link_my_app_link > register_top_menu(name='my_app', link=link_my_app_link) > > 6. Add you app to INSTALLED_APPS in mayan/settings/base.py and your app's > urls.py file to mayan/urls.py > > That should be it. > > Let us know how it goes. It would also be great if your could document the > process in the ticket (https://github.com/mayan-edms/mayan-edms/issues/175), > that would make creating the documentation topic file much easier. Thanks! > > > > On Saturday, April 4, 2015 at 3:32:27 PM UTC-4, Magan wrote: >> >> Hi, I've read as much as I found within this group, readthedocs and >> gmane, but couldn't find a way. >> >> I would like to execute a python script against a new document right >> after it is uploaded. >> >> But I'm not willing to modify the project itself since beyond this, I'd >> write an app to report the info concerning that post upload processing. >> >> >> - How to plug my script into Mayan? Or better yet, >> - How to add an app with my own views and model to the general >> project? >> >> >> If necessary, I'm willing to document that procedures. >> >> >> Thanks >> > -- --- 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.
