Skip to content

Commit df4b36c

Browse files
committed
Implement a latest_event for history entries, make canonical name for
charters depend on group acronym and save canonical name in history entries, - Legacy-Id: 4166
1 parent cce113e commit df4b36c

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

ietf/doc/models.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ def canonical_name(self):
171171
a = self.docalias_set.filter(name__startswith="rfc")
172172
if a:
173173
name = a[0].name
174+
elif self.type_id == "charter":
175+
return "charter-ietf-%s" % self.chartered_group.acronym
176+
174177
return name
175178

176179
class RelatedDocHistory(models.Model):
@@ -202,6 +205,10 @@ def __unicode__(self):
202205
def canonical_name(self):
203206
return self.name
204207

208+
def latest_event(self, *args, **kwargs):
209+
kwargs["time__lte"] = self.time
210+
return self.doc.latest_event(*args, **kwargs)
211+
205212
class Meta:
206213
verbose_name = "document history"
207214
verbose_name_plural = "document histories"
@@ -215,7 +222,7 @@ def get_model_fields_as_dict(obj):
215222
# copy fields
216223
fields = get_model_fields_as_dict(doc)
217224
fields["doc"] = doc
218-
fields["name"] = doc.name
225+
fields["name"] = doc.canonical_name()
219226

220227
dochist = DocHistory(**fields)
221228
dochist.save()

0 commit comments

Comments
 (0)