src/p4l/models/data.py
changeset 113 c05567404888
parent 108 c08f9b46a6c5
child 114 93b45b4f423c
equal deleted inserted replaced
112:ba6056f58516 113:c05567404888
   169     #Record import date and modification date
   169     #Record import date and modification date
   170     creation_date = models.DateTimeField( auto_now_add=True, serialize=False)
   170     creation_date = models.DateTimeField( auto_now_add=True, serialize=False)
   171     modification_date = models.DateTimeField(auto_now=True, serialize=False)
   171     modification_date = models.DateTimeField(auto_now=True, serialize=False)
   172     modified_by = models.ForeignKey(User, blank=True, null=True)
   172     modified_by = models.ForeignKey(User, blank=True, null=True)
   173     
   173     
       
   174     def get_titles(self):
       
   175         return [t.title for t in self.titles.all()]
       
   176     
       
   177     def get_authors(self):
       
   178         return [a.name for a in self.authors.all()]
       
   179     
   174     def get_imprints_years(self):
   180     def get_imprints_years(self):
   175         return sorted(set([i.imprintDate for i in self.imprints.all() if i.imprintDate]))
   181         return sorted(set([i.imprintDate for i in self.imprints.all() if i.imprintDate]))
   176 
   182 
   177     def __unicode__(self):
   183     def __unicode__(self):
   178         return "Record id %s { identifier: %s, uri: %s, editionStatement: %s,  recordType: %s, isDocumentPart: %s, notes: %s, language : %s}" \
   184         return "Record id %s { identifier: %s, uri: %s, editionStatement: %s,  recordType: %s, isDocumentPart: %s, notes: %s, language : %s}" \