src/p4l/models/data.py
changeset 104 b66ca6275115
parent 102 53c9233a7684
child 108 c08f9b46a6c5
equal deleted inserted replaced
103:468349edbf7f 104:b66ca6275115
     1 # -*- coding: utf-8 -*-
     1 # -*- coding: utf-8 -*-
     2 
     2 
     3 from django.db import models
     3 from django.db import models
       
     4 
     4 from p4l.models.common import P4lModel, P4lModelLang
     5 from p4l.models.common import P4lModel, P4lModelLang
       
     6 from p4l.models.user import User
     5 
     7 
     6 
     8 
     7 class Imprint(P4lModelLang):
     9 class Imprint(P4lModelLang):
     8     record = models.ForeignKey('p4l.Record', related_name="imprints")
    10     record = models.ForeignKey('p4l.Record', related_name="imprints")
     9     imprintCity = models.CharField(max_length=512, blank=True, null=True, db_index=True)
    11     imprintCity = models.CharField(max_length=512, blank=True, null=True, db_index=True)
   162     
   164     
   163     isDocumentPart = models.BooleanField() #iiep:isDocumentPart
   165     isDocumentPart = models.BooleanField() #iiep:isDocumentPart
   164     hidden = models.BooleanField(default=False) #iiep:hidden
   166     hidden = models.BooleanField(default=False) #iiep:hidden
   165     restricted = models.BooleanField(default=False) #iiep:restricted
   167     restricted = models.BooleanField(default=False) #iiep:restricted
   166     
   168     
       
   169     #Record import date and modification date
       
   170     creationDate = models.DateTimeField( auto_now_add=True, serialize=False)
       
   171     modificationDate = models.DateTimeField(auto_now=True, serialize=False)
       
   172     modifiedBy = models.ForeignKey(User, blank=True, null=True)
       
   173     
   167     def get_imprints_years(self):
   174     def get_imprints_years(self):
   168         return sorted(set([i.imprintDate for i in self.imprints.all() if i.imprintDate]))
   175         return sorted(set([i.imprintDate for i in self.imprints.all() if i.imprintDate]))
   169 
   176 
   170     def __unicode__(self):
   177     def __unicode__(self):
   171         return "Record id %s { identifier: %s, uri: %s, editionStatement: %s,  recordType: %s, isDocumentPart: %s, notes: %s, language : %s}" \
   178         return "Record id %s { identifier: %s, uri: %s, editionStatement: %s,  recordType: %s, isDocumentPart: %s, notes: %s, language : %s}" \