Send out expires as "null" in JSON rather than crashing if there's no

expiry on a document
 - Legacy-Id: 5079
This commit is contained in:
Ole Laursen 2012-11-27 12:08:56 +00:00
parent 8165048f11
commit 8eeef2def4

View file

@ -388,7 +388,7 @@ def document_json(request, name):
name=doc.group.name,
type=extract_name(doc.group.type),
acronym=doc.group.acronym)
data["expires"] = doc.expires.strftime("%Y-%m-%d %H:%M:%S")
data["expires"] = doc.expires.strftime("%Y-%m-%d %H:%M:%S") if doc.expires else None
data["title"] = doc.title
data["abstract"] = doc.abstract
data["aliases"] = list(doc.docalias_set.values_list("name", flat=True))