Added a docstring note about the convention for when save_*_in_history() shoudl be called.
- Legacy-Id: 4883
This commit is contained in:
parent
518d75cd88
commit
27186d111e
|
@ -379,6 +379,12 @@ class DocHistory(DocumentInfo):
|
|||
verbose_name_plural = "document histories"
|
||||
|
||||
def save_document_in_history(doc):
|
||||
"""This should be called before saving changes to a Document instance,
|
||||
so that the DocHistory entries contain all previous states, while
|
||||
the Group entry contain the current state. XXX TODO: Call this
|
||||
directly from Document.save(), and add event listeners for save()
|
||||
on related objects so we can save as needed when they change, too.
|
||||
"""
|
||||
def get_model_fields_as_dict(obj):
|
||||
return dict((field.name, getattr(obj, field.name))
|
||||
for field in obj._meta.fields
|
||||
|
|
|
@ -6,6 +6,11 @@ from ietf.group.models import *
|
|||
|
||||
|
||||
def save_group_in_history(group):
|
||||
"""This should be called before saving changes to a Group instance,
|
||||
so that the GroupHistory entries contain all previous states, while
|
||||
the Group entry contain the current state. XXX TODO: Call this
|
||||
directly from Group.save()
|
||||
"""
|
||||
def get_model_fields_as_dict(obj):
|
||||
return dict((field.name, getattr(obj, field.name))
|
||||
for field in obj._meta.fields
|
||||
|
|
Loading…
Reference in a new issue