|
| 1 | +from django.contrib.contenttypes import generic |
| 2 | +from django.contrib.contenttypes.models import ContentType |
| 3 | +from django.db import models |
| 4 | +from django.utils.translation import ugettext_lazy as _ |
| 5 | + |
| 6 | +from workflows.models import Workflow |
| 7 | +from permissions.models import Permission |
| 8 | + |
| 9 | + |
| 10 | +class ObjectWorkflowHistoryEntry(models.Model): |
| 11 | + content_type = models.ForeignKey(ContentType, verbose_name=_(u"Content type"), related_name="workflow_history", blank=True, null=True) |
| 12 | + content_id = models.PositiveIntegerField(_(u"Content id"), blank=True, null=True) |
| 13 | + content = generic.GenericForeignKey(ct_field="content_type", fk_field="content_id") |
| 14 | + |
| 15 | + from_state = models.CharField(_('From state'), max_length=100) |
| 16 | + to_state = models.CharField(_('To state'), max_length=100) |
| 17 | + transition_date = models.DateTimeField(_('Transition date')) |
| 18 | + comment = models.TextField(_('Comment')) |
| 19 | + |
| 20 | + |
| 21 | +class AnnotationTag(models.Model): |
| 22 | + name = models.CharField(_(u"Name"), max_length=100) |
| 23 | + workflow = models.ForeignKey(Workflow, verbose_name=_(u"Workflow"), related_name="annotation_tags") |
| 24 | + permission = models.ForeignKey(Permission, verbose_name=_(u"Permission"), blank=True, null=True) |
| 25 | + |
| 26 | + def __unicode__(self): |
| 27 | + return self.name |
| 28 | + |
| 29 | + |
| 30 | +class AnnotationTagObjectRelation(models.Model): |
| 31 | + content_type = models.ForeignKey(ContentType, verbose_name=_(u"Content type"), related_name="annotation_tags", blank=True, null=True) |
| 32 | + content_id = models.PositiveIntegerField(_(u"Content id"), blank=True, null=True) |
| 33 | + content = generic.GenericForeignKey(ct_field="content_type", fk_field="content_id") |
| 34 | + |
| 35 | + annotation_tag = models.ForeignKey(AnnotationTag, verbose_name=_(u"Annotation tag")) |
| 36 | + |
| 37 | + |
| 38 | +class ObjectAnnotationTagHistoryEntry(models.Model): |
| 39 | + content_type = models.ForeignKey(ContentType, verbose_name=_(u"Content type"), related_name="annotation_tags_history", blank=True, null=True) |
| 40 | + content_id = models.PositiveIntegerField(_(u"Content id"), blank=True, null=True) |
| 41 | + content = generic.GenericForeignKey(ct_field="content_type", fk_field="content_id") |
| 42 | + |
| 43 | + setted = models.TextField(_('Setted tags'), blank=True, null=True) |
| 44 | + unsetted = models.TextField(_('Unsetted tags'), blank=True, null=True) |
| 45 | + change_date = models.DateTimeField(_('Change date')) |
| 46 | + comment = models.TextField(_('Comment')) |
| 47 | + |
| 48 | + |
| 49 | +class WGWorkflow(Workflow): |
| 50 | + pass |
0 commit comments