Skip to content

Commit baf4fa9

Browse files
committed
Specific models in an IETF Workflow. Annotation tags and histories. See ietf-tools#535
- Legacy-Id: 2601
1 parent 51bb64b commit baf4fa9

4 files changed

Lines changed: 63 additions & 0 deletions

File tree

ietf/ietfworkflows/__init__.py

Whitespace-only changes.

ietf/ietfworkflows/admin.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from django.contrib import admin
2+
3+
from ietf.ietfworkflows.models import AnnotationTag, WGWorkflow
4+
from workflows.admin import StateInline
5+
6+
class AnnotationTagInline(admin.TabularInline):
7+
model = AnnotationTag
8+
9+
class IETFWorkflowAdmin(admin.ModelAdmin):
10+
inlines = [StateInline, AnnotationTagInline]
11+
12+
admin.site.register(WGWorkflow, IETFWorkflowAdmin)

ietf/ietfworkflows/models.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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

ietf/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@
133133
'ietf.redirects',
134134
'ietf.idrfc',
135135
'ietf.wginfo',
136+
'ietf.ietfworkflows',
136137
)
137138

138139
INTERNAL_IPS = (

0 commit comments

Comments
 (0)