Skip to content

Commit 27186d1

Browse files
committed
Added a docstring note about the convention for when save_*_in_history() shoudl be called.
- Legacy-Id: 4883
1 parent 518d75c commit 27186d1

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

ietf/doc/models.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,12 @@ class Meta:
379379
verbose_name_plural = "document histories"
380380

381381
def save_document_in_history(doc):
382+
"""This should be called before saving changes to a Document instance,
383+
so that the DocHistory entries contain all previous states, while
384+
the Group entry contain the current state. XXX TODO: Call this
385+
directly from Document.save(), and add event listeners for save()
386+
on related objects so we can save as needed when they change, too.
387+
"""
382388
def get_model_fields_as_dict(obj):
383389
return dict((field.name, getattr(obj, field.name))
384390
for field in obj._meta.fields

ietf/group/utils.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66

77

88
def save_group_in_history(group):
9+
"""This should be called before saving changes to a Group instance,
10+
so that the GroupHistory entries contain all previous states, while
11+
the Group entry contain the current state. XXX TODO: Call this
12+
directly from Group.save()
13+
"""
914
def get_model_fields_as_dict(obj):
1015
return dict((field.name, getattr(obj, field.name))
1116
for field in obj._meta.fields

0 commit comments

Comments
 (0)