modifying the DocumentVersion model

49 views
Skip to first unread message

Abdulhakim Tlimat

unread,
Dec 8, 2015, 5:40:40 AM12/8/15
to Mayan EDMS

I am trying to implement a new feature, i want to add a lifespan or an expiration date option to each document version (some documents will have such feature not necessarily all), say it's set to 90 days. a notification should be sent to some users after 90 days, and the document should be marked as outdated. until the document maintainer login and updates the document.

Mr.rosario already pointed me to add a separate app to manage DocumentType to lifespan setting but this does not exactly fit my needs.

so i decided to modify the DocumentVersion model i added:


expirationDate
= models.DateTimeField(blank=True, null=True, verbose_name=_('Expiration Date'))

versionNumber
= models.IntegerField(_('Version Number'), unique=True)


and i want them both to be visible on the Document versions list but i cant figure out how to add columns to that generic list template.
here is the view i need modified in Documents app .views

class DocumentVersionListView(SingleObjectListView):

at later stage i will add a periodic task to check the latest version of each document if they have expirationDate set and it's expired. and will notify the document creator
so my questions are:
1. is this a good approach to my problem or there's a better way to do it (i still need each version to have an expiration date set to it) ?
2. how do i view the new two fields in the document versions list ?

thanks all

Roberto Rosario

unread,
Dec 11, 2015, 5:19:24 PM12/11/15
to Mayan EDMS
I've created a project in the gitlab to allow easier collaboration: https://gitlab.com/mayan-edms/versionlifespan

Roberto Rosario

unread,
Dec 13, 2015, 3:12:54 AM12/13/15
to Mayan EDMS

Progress so far:

  • Base app
  • Model with, separate lifespan (expiration) for each document version in the system.
  • View
  • Permission
  • Link
  • Model tests
  • Signal handler

TODO:

  • Default lifespan for newly created document versions.
  • What to do with expired document versions.
  • Finish packaging: setup.py, coverage, docs, Manifest
  • Translations
  • API endpoint
  • View test
  • API test




Abdulhakim Tlimat

unread,
Dec 14, 2015, 12:22:03 PM12/14/15
to mayan...@googlegroups.com
So i cloned mayan-edms, cloned the new version lifespan app (inside the apps directory), added versions_lifespan to installed apps in settings base.py, then (inside a virtualenv) i installed requirements and manage.py migrate and createsuperuser and runserver with settings flag --settings=mayan.settings.development. everything works (except for database locks due to using sqlite) but i can't see the edit lifespan button you showed me in those screenshots in the docuement versions list. what am i doing wrong ?
--

---
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/kh8piRUB-sM/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.

Roberto Rosario

unread,
Dec 14, 2015, 1:08:49 PM12/14/15
to Mayan EDMS
There was no default_app_config in __init__.py so the full path of the App had to be used in the INSTALLED_APPS list (versions_lifespans.apps.VersionsLifespansApp). This is fixed now so either should work (versions_lifespans.apps.VersionsLifespansApp or just versions_lifespans).

Also, clone the app repository outside of the Mayan directory as the app is not the top level directory in Django app repositories.

<repository name>/<actual app code>

Symlink the <actual app code> into Mayan's app directory.

Run the migrations.

Updated instructions added to README here: https://gitlab.com/mayan-edms/versionlifespan/commit/917003ef77ce554c5c026605779a53f509f1665e
To unsubscribe from this group and all its topics, send an email to mayan-edms+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages