예제 #1
0
 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)
예제 #2
0
파일: models.py 프로젝트: open-oni/open-oni
 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)
예제 #3
0
    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
예제 #4
0
파일: models.py 프로젝트: open-oni/open-oni
    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