Skip to content

Commit 75e33a6

Browse files
committed
Add person to state/tags object history. Fixes ietf-tools#543
- Legacy-Id: 2746
1 parent 2427962 commit 75e33a6

3 files changed

Lines changed: 125 additions & 2 deletions

File tree

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
2+
from south.db import db
3+
from django.db import models
4+
from ietf.ietfworkflows.models import *
5+
6+
class Migration:
7+
8+
def forwards(self, orm):
9+
10+
# Adding field 'ObjectWorkflowHistoryEntry.person'
11+
db.add_column('ietfworkflows_objectworkflowhistoryentry', 'person', orm['ietfworkflows.objectworkflowhistoryentry:person'])
12+
13+
# Adding field 'ObjectAnnotationTagHistoryEntry.person'
14+
db.add_column('ietfworkflows_objectannotationtaghistoryentry', 'person', orm['ietfworkflows.objectannotationtaghistoryentry:person'])
15+
16+
17+
18+
def backwards(self, orm):
19+
20+
# Deleting field 'ObjectWorkflowHistoryEntry.person'
21+
db.delete_column('ietfworkflows_objectworkflowhistoryentry', 'person_id')
22+
23+
# Deleting field 'ObjectAnnotationTagHistoryEntry.person'
24+
db.delete_column('ietfworkflows_objectannotationtaghistoryentry', 'person_id')
25+
26+
27+
28+
models = {
29+
'contenttypes.contenttype': {
30+
'Meta': {'unique_together': "(('app_label', 'model'),)", 'db_table': "'django_content_type'"},
31+
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
32+
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
33+
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
34+
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
35+
},
36+
'idtracker.personororginfo': {
37+
'Meta': {'db_table': "'person_or_org_info'"},
38+
'address_type': ('django.db.models.fields.CharField', [], {'max_length': '4', 'null': 'True', 'blank': 'True'}),
39+
'created_by': ('django.db.models.fields.CharField', [], {'max_length': '8', 'null': 'True', 'blank': 'True'}),
40+
'date_created': ('django.db.models.fields.DateField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}),
41+
'date_modified': ('django.db.models.fields.DateField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}),
42+
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
43+
'first_name_key': ('django.db.models.fields.CharField', [], {'max_length': '20', 'blank': 'True'}),
44+
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
45+
'last_name_key': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
46+
'middle_initial': ('django.db.models.fields.CharField', [], {'max_length': '4', 'null': 'True', 'blank': 'True'}),
47+
'middle_initial_key': ('django.db.models.fields.CharField', [], {'max_length': '4', 'null': 'True', 'blank': 'True'}),
48+
'modified_by': ('django.db.models.fields.CharField', [], {'max_length': '8', 'null': 'True', 'blank': 'True'}),
49+
'name_prefix': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
50+
'name_suffix': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
51+
'person_or_org_tag': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
52+
'record_type': ('django.db.models.fields.CharField', [], {'max_length': '8', 'null': 'True', 'blank': 'True'})
53+
},
54+
'ietfworkflows.annotationtag': {
55+
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
56+
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
57+
'permission': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['permissions.Permission']", 'null': 'True', 'blank': 'True'}),
58+
'workflow': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'annotation_tags'", 'to': "orm['workflows.Workflow']"})
59+
},
60+
'ietfworkflows.annotationtagobjectrelation': {
61+
'annotation_tag': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['ietfworkflows.AnnotationTag']"}),
62+
'content_id': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
63+
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'annotation_tags'", 'null': 'True', 'to': "orm['contenttypes.ContentType']"}),
64+
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
65+
},
66+
'ietfworkflows.objectannotationtaghistoryentry': {
67+
'change_date': ('django.db.models.fields.DateTimeField', [], {}),
68+
'comment': ('django.db.models.fields.TextField', [], {}),
69+
'content_id': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
70+
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'annotation_tags_history'", 'null': 'True', 'to': "orm['contenttypes.ContentType']"}),
71+
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
72+
'person': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['idtracker.PersonOrOrgInfo']"}),
73+
'setted': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
74+
'unsetted': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'})
75+
},
76+
'ietfworkflows.objectworkflowhistoryentry': {
77+
'comment': ('django.db.models.fields.TextField', [], {}),
78+
'content_id': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
79+
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'workflow_history'", 'null': 'True', 'to': "orm['contenttypes.ContentType']"}),
80+
'from_state': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
81+
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
82+
'person': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['idtracker.PersonOrOrgInfo']"}),
83+
'to_state': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
84+
'transition_date': ('django.db.models.fields.DateTimeField', [], {})
85+
},
86+
'ietfworkflows.wgworkflow': {
87+
'selected_states': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['workflows.State']", 'symmetrical': 'False'}),
88+
'selected_tags': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['ietfworkflows.AnnotationTag']", 'symmetrical': 'False'}),
89+
'workflow_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['workflows.Workflow']", 'unique': 'True', 'primary_key': 'True'})
90+
},
91+
'permissions.permission': {
92+
'codename': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}),
93+
'content_types': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['contenttypes.ContentType']", 'null': 'True', 'blank': 'True'}),
94+
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
95+
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'})
96+
},
97+
'workflows.state': {
98+
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
99+
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
100+
'transitions': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['workflows.Transition']", 'null': 'True', 'blank': 'True'}),
101+
'workflow': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'states'", 'to': "orm['workflows.Workflow']"})
102+
},
103+
'workflows.transition': {
104+
'condition': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
105+
'destination': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'destination_state'", 'null': 'True', 'to': "orm['workflows.State']"}),
106+
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
107+
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
108+
'permission': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['permissions.Permission']", 'null': 'True', 'blank': 'True'}),
109+
'workflow': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'transitions'", 'to': "orm['workflows.Workflow']"})
110+
},
111+
'workflows.workflow': {
112+
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
113+
'initial_state': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'workflow_state'", 'null': 'True', 'to': "orm['workflows.State']"}),
114+
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}),
115+
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['permissions.Permission']", 'symmetrical': 'False'})
116+
}
117+
}
118+
119+
complete_apps = ['ietfworkflows']

ietf/ietfworkflows/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from django.db import models
44
from django.utils.translation import ugettext_lazy as _
55

6+
from ietf.idtracker.models import PersonOrOrgInfo
67
from workflows.models import Workflow, State
78
from permissions.models import Permission
89

@@ -16,6 +17,7 @@ class ObjectWorkflowHistoryEntry(models.Model):
1617
to_state = models.CharField(_('To state'), max_length=100)
1718
transition_date = models.DateTimeField(_('Transition date'))
1819
comment = models.TextField(_('Comment'))
20+
person = models.ForeignKey(PersonOrOrgInfo)
1921

2022

2123
class AnnotationTag(models.Model):
@@ -44,6 +46,7 @@ class ObjectAnnotationTagHistoryEntry(models.Model):
4446
unsetted = models.TextField(_('Unsetted tags'), blank=True, null=True)
4547
change_date = models.DateTimeField(_('Change date'))
4648
comment = models.TextField(_('Comment'))
49+
person = models.ForeignKey(PersonOrOrgInfo)
4750

4851

4952
class WGWorkflow(Workflow):

ietf/ietfworkflows/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def reset_tag_by_name(obj, tag_name):
126126
return False
127127

128128

129-
def update_tags(obj, comment, set_tags=[], reset_tags=[]):
129+
def update_tags(obj, comment, person, set_tags=[], reset_tags=[]):
130130
ctype = ContentType.objects.get_for_model(obj)
131131
setted = []
132132
resetted = []
@@ -142,4 +142,5 @@ def update_tags(obj, comment, set_tags=[], reset_tags=[]):
142142
setted = ','.join(setted),
143143
unsetted = ','.join(resetted),
144144
change_date = datetime.datetime.now(),
145-
comment = comment)
145+
comment = comment,
146+
person=person)

0 commit comments

Comments
 (0)