src/p4l/models/data.py
author ymh <ymh.work@gmail.com>
Sat, 21 Sep 2013 23:49:04 +0200
changeset 114 93b45b4f423c
parent 113 c05567404888
child 126 a345f1a67bf1
permissions -rw-r--r--
add corporate authors and small adjustments
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
# -*- coding: utf-8 -*-
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
from django.db import models
104
b66ca6275115 add creation + modification fields
ymh <ymh.work@gmail.com>
parents: 102
diff changeset
     4
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
from p4l.models.common import P4lModel, P4lModelLang
104
b66ca6275115 add creation + modification fields
ymh <ymh.work@gmail.com>
parents: 102
diff changeset
     6
from p4l.models.user import User
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
class Imprint(P4lModelLang):
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
    record = models.ForeignKey('p4l.Record', related_name="imprints")
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
    imprintCity = models.CharField(max_length=512, blank=True, null=True, db_index=True)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
    publisher = models.CharField(max_length=512, blank=True, null=True, db_index=True)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
    imprintDate = models.CharField(max_length=512, blank=True, null=True, db_index=True)    
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
    16
class Serie(P4lModelLang):
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
    17
    record = models.ForeignKey('p4l.Record', related_name="series")
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
    title = models.CharField(max_length=2048, blank=False, null=False, db_index=True)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
    volume = models.CharField(max_length=2048, blank=True, null=True, db_index=True)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
class ProjectName(P4lModel):
14
52fa6990e0bb adapt model to new rdf serialization
ymh <ymh.work@gmail.com>
parents: 13
diff changeset
    23
    uri = models.URLField(max_length=2048, unique=True, db_index=True) 
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
class CorporateAuthor(P4lModel):
14
52fa6990e0bb adapt model to new rdf serialization
ymh <ymh.work@gmail.com>
parents: 13
diff changeset
    27
    uri = models.URLField(max_length=2048, unique=True, db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
class Url(P4lModel):
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
    30
    record = models.ForeignKey('p4l.Record', related_name="urls", db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
    address = models.CharField(max_length=2048, blank=False, null=False, db_index=True) #iiep:address
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
    display = models.CharField(max_length=2048, blank=True, null=True, db_index=True) #iiep:display
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
class Subject(P4lModel):
14
52fa6990e0bb adapt model to new rdf serialization
ymh <ymh.work@gmail.com>
parents: 13
diff changeset
    36
    uri = models.URLField(max_length=2048, unique=True, db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    38
class Theme(P4lModel):
14
52fa6990e0bb adapt model to new rdf serialization
ymh <ymh.work@gmail.com>
parents: 13
diff changeset
    39
    uri = models.URLField(max_length=2048, unique=True, db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    40
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    41
class Country(P4lModel):
14
52fa6990e0bb adapt model to new rdf serialization
ymh <ymh.work@gmail.com>
parents: 13
diff changeset
    42
    uri = models.URLField(max_length=2048, unique=True, db_index=True)
97
12bbec897e48 model change (again)
cavaliet
parents: 93
diff changeset
    43
12bbec897e48 model change (again)
cavaliet
parents: 93
diff changeset
    44
class Audience(P4lModel):
12bbec897e48 model change (again)
cavaliet
parents: 93
diff changeset
    45
    uri = models.URLField(max_length=2048, unique=True, db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    46
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
class Isbn(P4lModelLang):
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
    49
    record = models.ForeignKey('p4l.Record', related_name="isbns", db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
    isbn = models.CharField(max_length=128) #iiep:isbn
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    51
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    52
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    53
class Issn(P4lModelLang):
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
    54
    record = models.ForeignKey('p4l.Record', related_name="issns", db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    55
    issn = models.CharField(max_length=128) #iiep:issn
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    56
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    57
class DocumentCode(P4lModelLang):
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
    58
    record = models.ForeignKey('p4l.Record', related_name="documentCodes", db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    59
    documentCode = models.CharField(max_length=128) #iiep:issn
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    60
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    61
class Language(P4lModel):
14
52fa6990e0bb adapt model to new rdf serialization
ymh <ymh.work@gmail.com>
parents: 13
diff changeset
    62
    uri = models.URLField(max_length=2048, unique=True, db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    63
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    64
class BaseTitle(P4lModelLang):
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    65
    title = models.CharField(max_length=2048, blank=False, null=False, db_index=True)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    66
    class Meta(P4lModelLang.Meta):
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    67
        abstract = True
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    68
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    69
class Title(BaseTitle):
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
    70
    record = models.ForeignKey('p4l.Record', related_name="titles", db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    71
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    72
class AddedTitle(BaseTitle):
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
    73
    record = models.ForeignKey('p4l.Record', related_name="addedTitles", db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    74
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    75
class TitleMainDocument(BaseTitle):
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
    76
    record = models.ForeignKey('p4l.Record', related_name="titlesMainDocument", db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    77
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    78
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    79
class Abstract(P4lModelLang):
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
    80
    record = models.ForeignKey('p4l.Record', related_name="abstracts", db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    81
    abstract = models.TextField(blank=True, null=True)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    82
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    83
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    84
class Collation(P4lModelLang):
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
    85
    record = models.ForeignKey('p4l.Record', related_name="collations", db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    86
    collation = models.CharField(max_length=1024, blank=False, null=False, db_index=True)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    87
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    88
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    89
class VolumeIssue(P4lModelLang):
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
    90
    record = models.ForeignKey('p4l.Record', related_name="volumeIssues", db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    91
    volume = models.CharField(max_length=1024, blank=True, null=True, db_index=True) #iiep:volume
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    92
    number = models.CharField(max_length=1024, blank=True, null=True, db_index=True) #iiep:number
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    93
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    94
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    95
class P4lPerson(P4lModel):
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
    96
    name = models.CharField(max_length=2048, blank=False, null=False, db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    97
    class Meta(P4lModel.Meta):
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    98
        abstract = True
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    99
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   100
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   101
class Author(P4lPerson):
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
   102
    record = models.ForeignKey('p4l.Record', related_name="authors", db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   103
    
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   104
class SubjectPerson(P4lPerson):
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
   105
    record = models.ForeignKey('p4l.Record', related_name="subjectPersons", db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   106
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
   107
class Periodical(P4lModelLang):
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
   108
    record = models.ForeignKey('p4l.Record', related_name="periodicals", db_index=True)
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
   109
    label = models.CharField(max_length=2048, blank=False, null=False, db_index=True) #iiep:periodical
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   110
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   111
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   112
class BaseMeeting(P4lModel):
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   113
    label = models.CharField(max_length=2048, blank=False, null=False, db_index=True) #rdfs:label
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   114
    meetingNumber = models.CharField(max_length=2048, blank=True, null=True, db_index=True) #iiep:meetingNumber
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   115
    meetingPlace = models.CharField(max_length=2048, blank=True, null=True, db_index=True) #iiep:meetingPlace
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   116
    meetingDate = models.CharField(max_length=2048, blank=True, null=True, db_index=True) #iiep:meetingDate
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   117
    meetingYear = models.PositiveSmallIntegerField(blank=True, null=True, db_index=True) #iiep:meetingYear
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   118
    class Meta(P4lModel.Meta):
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   119
        abstract = True
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   120
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   121
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   122
class Meeting(BaseMeeting):
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
   123
    lang = models.CharField(max_length=15, blank=True, null=True, db_index=True) #@xml:lang
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
   124
    record = models.ForeignKey('p4l.Record', related_name="meetings")
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   125
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   126
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   127
class SubjectMeeting(BaseMeeting):
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
   128
    record = models.ForeignKey('p4l.Record', related_name="subjectMeetings", db_index=True)
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   129
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   130
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   131
class Record(P4lModel):
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   132
    uri = models.URLField(max_length=2048, unique=True, db_index=True) #subject
17
b31a67614f76 fill labels with sparql request on the go
cavaliet
parents: 14
diff changeset
   133
    subjects = models.ManyToManyField('p4l.Subject') #dct:subject                                                       # <Thesaurus> with no country
b31a67614f76 fill labels with sparql request on the go
cavaliet
parents: 14
diff changeset
   134
    themes = models.ManyToManyField('p4l.Theme') #iiep:theme                                                            # <Themes>
b31a67614f76 fill labels with sparql request on the go
cavaliet
parents: 14
diff changeset
   135
    countries = models.ManyToManyField('p4l.Country') #iiep:country                                                     # <Thesaurus> filtered with country only
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   136
    identifier = models.CharField(max_length=128, unique=True, db_index=True) #dct:identifier    
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   137
    notes = models.TextField(blank=True, null=True) #iiep:notes    
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   138
    #issns foreign key from Isbn #iiep:issn
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   139
    #isbns foreign key from Isbn #iiep:isbn
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   140
    #documentCodes foreign key from Isbn #iiep:documentCode
17
b31a67614f76 fill labels with sparql request on the go
cavaliet
parents: 14
diff changeset
   141
    language = models.ForeignKey('p4l.Language', blank=True, null=True) #dct:language                                    # <Languages>
b31a67614f76 fill labels with sparql request on the go
cavaliet
parents: 14
diff changeset
   142
    otherLanguages = models.ManyToManyField('p4l.Language', related_name='otherLanguage_record') #iiep:otherLanguage     # <Languages>
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   143
    #titles foreign Key from Title #dct:title
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
   144
    #abstracts foreign Key from Abstract #dct:abstract
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   145
    #addedTitles foreign Key from AddedTitle #iiep:addedTitle
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   146
    #titlesMainDocument foreign Key from TitleMainDocument #iiep:titleMainDocument
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   147
    editionStatement = models.CharField(max_length=1024, blank=True, null=True) #iiep:editionStatement
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   148
    #imprints foreign Key from Imprint #iiep:imprint
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   149
    #collations = foreign Key from Collation #iiep:collation
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   150
    #volumeIssues = foreign Key from VolumeIssue #iiep:volumeIssue
17
b31a67614f76 fill labels with sparql request on the go
cavaliet
parents: 14
diff changeset
   151
    projectNames = models.ManyToManyField('p4l.ProjectName') #iiep:projectName                                            # <Projects>
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
   152
    #periodicals = foreign key from 'p4l.Periodical' #iiep:periodical
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
   153
    #meetings = foreign key from 'p4l.Meeting' #iiep:meeting
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
   154
    #series = foreign key from 'p4l.Serie'  #iiep:serie
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
   155
    #authors = foreign key from 'p4l.Author' #iiep:author
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
   156
    #subjectPersons = foreign key from 'p4l.SubjectPerson' #iiep:subjectPerson
17
b31a67614f76 fill labels with sparql request on the go
cavaliet
parents: 14
diff changeset
   157
    subjectCorporateBodies = models.ManyToManyField('p4l.CorporateAuthor', related_name='recordsSubjectCorporateBody') #iiep:subjectCorporateBody # <Organizations>
13
6296aa12fd71 model simplification, correct import on language. We do not try to impose a language when none is found. add forgotten abstract field on import.
ymh <ymh.work@gmail.com>
parents: 10
diff changeset
   158
    #subjectMeetings = foreign key from 'p4l.SubjectMeeting' #iiep:subjectMeeting
17
b31a67614f76 fill labels with sparql request on the go
cavaliet
parents: 14
diff changeset
   159
    corporateAuthors = models.ManyToManyField('p4l.CorporateAuthor', related_name='recordsCorporateAuthor') #iiep:subjectCorporateBody # <Organizations>
97
12bbec897e48 model change (again)
cavaliet
parents: 93
diff changeset
   160
    corporateAuthorLabel = models.CharField(max_length=2048, blank=True, null=True, db_index=True) #iiep:corporateAuthorLabel
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   161
    #urls foreign Key from Url #iiep:url
100
5b076700ac05 Debug and coherent field names
cavaliet
parents: 97
diff changeset
   162
    audiences = models.ManyToManyField('p4l.Audience') #dct:audience                                                      # Unknown thesaurus
97
12bbec897e48 model change (again)
cavaliet
parents: 93
diff changeset
   163
    recordType = models.URLField(max_length=2048, blank=True, null=True) #dct:type                                        # <DocumentType>
14
52fa6990e0bb adapt model to new rdf serialization
ymh <ymh.work@gmail.com>
parents: 13
diff changeset
   164
    
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   165
    isDocumentPart = models.BooleanField() #iiep:isDocumentPart
100
5b076700ac05 Debug and coherent field names
cavaliet
parents: 97
diff changeset
   166
    hidden = models.BooleanField(default=False) #iiep:hidden
5b076700ac05 Debug and coherent field names
cavaliet
parents: 97
diff changeset
   167
    restricted = models.BooleanField(default=False) #iiep:restricted
75
eb6530b77b0e Add years in list view
ymh <ymh.work@gmail.com>
parents: 62
diff changeset
   168
    
104
b66ca6275115 add creation + modification fields
ymh <ymh.work@gmail.com>
parents: 102
diff changeset
   169
    #Record import date and modification date
108
c08f9b46a6c5 use PEP8 convention on system fields for Records
ymh <ymh.work@gmail.com>
parents: 104
diff changeset
   170
    creation_date = models.DateTimeField( auto_now_add=True, serialize=False)
c08f9b46a6c5 use PEP8 convention on system fields for Records
ymh <ymh.work@gmail.com>
parents: 104
diff changeset
   171
    modification_date = models.DateTimeField(auto_now=True, serialize=False)
c08f9b46a6c5 use PEP8 convention on system fields for Records
ymh <ymh.work@gmail.com>
parents: 104
diff changeset
   172
    modified_by = models.ForeignKey(User, blank=True, null=True)
104
b66ca6275115 add creation + modification fields
ymh <ymh.work@gmail.com>
parents: 102
diff changeset
   173
    
113
c05567404888 First version of indexation. Replace the list view by a search view
ymh <ymh.work@gmail.com>
parents: 108
diff changeset
   174
    def get_titles(self):
c05567404888 First version of indexation. Replace the list view by a search view
ymh <ymh.work@gmail.com>
parents: 108
diff changeset
   175
        return [t.title for t in self.titles.all()]
c05567404888 First version of indexation. Replace the list view by a search view
ymh <ymh.work@gmail.com>
parents: 108
diff changeset
   176
    
c05567404888 First version of indexation. Replace the list view by a search view
ymh <ymh.work@gmail.com>
parents: 108
diff changeset
   177
    def get_authors(self):
c05567404888 First version of indexation. Replace the list view by a search view
ymh <ymh.work@gmail.com>
parents: 108
diff changeset
   178
        return [a.name for a in self.authors.all()]
c05567404888 First version of indexation. Replace the list view by a search view
ymh <ymh.work@gmail.com>
parents: 108
diff changeset
   179
    
114
93b45b4f423c add corporate authors and small adjustments
ymh <ymh.work@gmail.com>
parents: 113
diff changeset
   180
    def get_corporate_authors(self):
93b45b4f423c add corporate authors and small adjustments
ymh <ymh.work@gmail.com>
parents: 113
diff changeset
   181
        return [c.uri for c in self.corporateAuthors.all()]
93b45b4f423c add corporate authors and small adjustments
ymh <ymh.work@gmail.com>
parents: 113
diff changeset
   182
    
75
eb6530b77b0e Add years in list view
ymh <ymh.work@gmail.com>
parents: 62
diff changeset
   183
    def get_imprints_years(self):
77
15b34232100d Make sure we do not takes null or empty values
ymh <ymh.work@gmail.com>
parents: 76
diff changeset
   184
        return sorted(set([i.imprintDate for i in self.imprints.all() if i.imprintDate]))
0
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   185
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   186
    def __unicode__(self):
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   187
        return "Record id %s { identifier: %s, uri: %s, editionStatement: %s,  recordType: %s, isDocumentPart: %s, notes: %s, language : %s}" \
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   188
            % (
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   189
                self.id,
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   190
                self.identifier,
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   191
                self.uri,
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   192
                self.editionStatement,
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   193
                self.recordType,
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   194
                self.isDocumentPart,
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   195
                self.notes[:100] if self.notes else None,
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   196
                self.language.id if self.language else None
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   197
            )
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   198
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   199
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}issn', 3)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   200
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}documentCode', 3)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   201
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}country', 44)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   202
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}imprint', 5)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   203
#('{http://purl.org/dc/terms/}title', 4)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   204
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}isDocumentPart', 1)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   205
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}notes', 1)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   206
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}isbn', 8)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   207
#('{http://purl.org/dc/terms/}identifier', 1)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   208
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}meeting', 4)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   209
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}projectName', 10)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   210
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}addedTitle', 18)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   211
#('{http://purl.org/dc/terms/}subject', 29)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   212
#('{http://purl.org/dc/terms/}language', 1)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   213
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}serie', 4)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   214
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}volumeIssue', 3)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   215
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}url', 20)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   216
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}titleMainDocument', 3)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   217
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}otherLanguage', 13)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   218
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}periodical', 3)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   219
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}editionStatement', 1)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   220
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}collation', 4)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   221
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}subjectMeeting', 6)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   222
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}corporateAuthor', 7)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   223
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}author', 26)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   224
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}subjectPerson', 2)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   225
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}subjectCorporateBody', 8)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   226
#('{http://www.iiep.unesco.org/plan4learning/model.owl#}theme', 6)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   227
#('{http://purl.org/dc/terms/}abstract', 3)
81e7900b06a7 First import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   228
#('{http://purl.org/dc/terms/}type', 1)