def __unicode__(self): parts = [u'%s' % self.issue.title] # little hack to get django's datetime support for stftime # when the year is < 1900 parts.append(strftime(self.issue.date_issued, '%B %d, %Y')) if self.issue.edition_label: parts.append(self.issue.edition_label) if self.section_label: parts.append(self.section_label) parts.append('Image %s' % self.sequence) return u', '.join(parts)
def json(self, host, serialize=True): j = { "@context": "http://iiif.io/api/presentation/2/context.json", "@id": settings.BASE_URL + self.json_url, "@type": "sc:Collection", "label": self.display_name, "manifests": [], "metadata": self.metadata } for issue in self.issues.all(): j["manifests"].append({ "@id": settings.BASE_URL + issue.json_url, "@type": "sc:Manifest", "label": strftime(issue.date_issued, "%Y-%m-%d") }) if serialize: return json.dumps(j, indent=2) return j