| 1 | # -*- coding: utf-8 -*- |
|---|
| 2 | # Copyright (C) 2007-2010 Samalyse SARL |
|---|
| 3 | |
|---|
| 4 | # This software is a computer program whose purpose is to backup, analyse, |
|---|
| 5 | # transcode and stream any audio content with its metadata over a web frontend. |
|---|
| 6 | |
|---|
| 7 | # This software is governed by the CeCILL license under French law and |
|---|
| 8 | # abiding by the rules of distribution of free software. You can use, |
|---|
| 9 | # modify and/ or redistribute the software under the terms of the CeCILL |
|---|
| 10 | # license as circulated by CEA, CNRS and INRIA at the following URL |
|---|
| 11 | # "http://www.cecill.info". |
|---|
| 12 | |
|---|
| 13 | # As a counterpart to the access to the source code and rights to copy, |
|---|
| 14 | # modify and redistribute granted by the license, users are provided only |
|---|
| 15 | # with a limited warranty and the software's author, the holder of the |
|---|
| 16 | # economic rights, and the successive licensors have only limited |
|---|
| 17 | # liability. |
|---|
| 18 | |
|---|
| 19 | # In this respect, the user's attention is drawn to the risks associated |
|---|
| 20 | # with loading, using, modifying and/or developing or reproducing the |
|---|
| 21 | # software by the user in light of its specific status of free software, |
|---|
| 22 | # that may mean that it is complicated to manipulate, and that also |
|---|
| 23 | # therefore means that it is reserved for developers and experienced |
|---|
| 24 | # professionals having in-depth computer knowledge. Users are therefore |
|---|
| 25 | # encouraged to load and test the software's suitability as regards their |
|---|
| 26 | # requirements in conditions enabling the security of their systems and/or |
|---|
| 27 | # data to be ensured and, more generally, to use and operate it in the |
|---|
| 28 | # same conditions as regards security. |
|---|
| 29 | |
|---|
| 30 | # The fact that you are presently reading this means that you have had |
|---|
| 31 | # knowledge of the CeCILL license and that you accept its terms. |
|---|
| 32 | # |
|---|
| 33 | # Authors: Olivier Guilyardi <olivier@samalyse.com> |
|---|
| 34 | # David LIPSZYC <davidlipszyc@gmail.com> |
|---|
| 35 | |
|---|
| 36 | from telemeta.models.core import * |
|---|
| 37 | from django.utils.translation import ugettext_lazy as _ |
|---|
| 38 | |
|---|
| 39 | class Enumeration(ModelCore): |
|---|
| 40 | "Abstract enumerations base class" |
|---|
| 41 | value = CharField(_('value'), required=True, unique=True) |
|---|
| 42 | |
|---|
| 43 | def __unicode__(self): |
|---|
| 44 | return self.value |
|---|
| 45 | |
|---|
| 46 | class Meta(MetaCore): |
|---|
| 47 | abstract = True |
|---|
| 48 | |
|---|
| 49 | class MetaEnumeration(MetaCore): |
|---|
| 50 | ordering = ['value'] |
|---|
| 51 | |
|---|
| 52 | class PhysicalFormat(Enumeration): |
|---|
| 53 | "Collection physical format" |
|---|
| 54 | |
|---|
| 55 | class Meta(MetaEnumeration): |
|---|
| 56 | db_table = 'physical_formats' |
|---|
| 57 | verbose_name = _("archive format") |
|---|
| 58 | |
|---|
| 59 | class PublishingStatus(Enumeration): |
|---|
| 60 | "Collection publishing status" |
|---|
| 61 | |
|---|
| 62 | class Meta(MetaEnumeration): |
|---|
| 63 | db_table = 'publishing_status' |
|---|
| 64 | verbose_name = _("secondary edition") |
|---|
| 65 | |
|---|
| 66 | class AcquisitionMode(Enumeration): |
|---|
| 67 | "Mode of acquisition of the collection" |
|---|
| 68 | |
|---|
| 69 | class Meta(MetaEnumeration): |
|---|
| 70 | db_table = 'acquisition_modes' |
|---|
| 71 | verbose_name = _("mode of acquisition") |
|---|
| 72 | |
|---|
| 73 | class MetadataAuthor(Enumeration): |
|---|
| 74 | "Collection metadata author" |
|---|
| 75 | |
|---|
| 76 | class Meta(MetaEnumeration): |
|---|
| 77 | db_table = 'metadata_authors' |
|---|
| 78 | verbose_name = _("record author") |
|---|
| 79 | |
|---|
| 80 | class MetadataWriter(Enumeration): |
|---|
| 81 | "Collection metadata writer" |
|---|
| 82 | |
|---|
| 83 | class Meta(MetaEnumeration): |
|---|
| 84 | db_table = 'metadata_writers' |
|---|
| 85 | verbose_name = _("record writer") |
|---|
| 86 | |
|---|
| 87 | class LegalRight(Enumeration): |
|---|
| 88 | "Collection legal rights" |
|---|
| 89 | |
|---|
| 90 | class Meta(MetaEnumeration): |
|---|
| 91 | db_table = 'legal_rights' |
|---|
| 92 | verbose_name = _("legal rights") |
|---|
| 93 | |
|---|
| 94 | class RecordingContext(Enumeration): |
|---|
| 95 | "Collection recording context" |
|---|
| 96 | |
|---|
| 97 | class Meta(MetaEnumeration): |
|---|
| 98 | db_table = 'recording_contexts' |
|---|
| 99 | verbose_name = _("recording context") |
|---|
| 100 | |
|---|
| 101 | class AdConversion(Enumeration): |
|---|
| 102 | "Collection digital to analog conversion status" |
|---|
| 103 | |
|---|
| 104 | class Meta(MetaEnumeration): |
|---|
| 105 | db_table = 'ad_conversions' |
|---|
| 106 | verbose_name = _("A/D conversion") |
|---|
| 107 | |
|---|
| 108 | class VernacularStyle(Enumeration): |
|---|
| 109 | "Item vernacular style" |
|---|
| 110 | |
|---|
| 111 | class Meta(MetaEnumeration): |
|---|
| 112 | db_table = 'vernacular_styles' |
|---|
| 113 | verbose_name = _("vernacular style") |
|---|
| 114 | |
|---|
| 115 | class GenericStyle(Enumeration): |
|---|
| 116 | "Item generic style" |
|---|
| 117 | |
|---|
| 118 | class Meta(MetaEnumeration): |
|---|
| 119 | db_table = 'generic_styles' |
|---|
| 120 | verbose_name = _("generic style") |
|---|
| 121 | |
|---|
| 122 | class ContextKeyword(Enumeration): |
|---|
| 123 | "Keyword" |
|---|
| 124 | |
|---|
| 125 | class Meta(MetaEnumeration): |
|---|
| 126 | db_table = 'context_keywords' |
|---|
| 127 | verbose_name = _("keyword") |
|---|
| 128 | |
|---|
| 129 | class Publisher(Enumeration): |
|---|
| 130 | "Collection publisher" |
|---|
| 131 | |
|---|
| 132 | class Meta(MetaEnumeration): |
|---|
| 133 | db_table = 'publishers' |
|---|
| 134 | verbose_name = _("publisher / status") |
|---|
| 135 | |
|---|
| 136 | class PublisherCollection(ModelCore): |
|---|
| 137 | "Collection which belongs to publisher" |
|---|
| 138 | publisher = ForeignKey('Publisher', related_name="publisher_collections", verbose_name=_('publisher')) |
|---|
| 139 | value = CharField(_('value'), required=True) |
|---|
| 140 | |
|---|
| 141 | def __unicode__(self): |
|---|
| 142 | return self.value |
|---|
| 143 | |
|---|
| 144 | class Meta(MetaCore): |
|---|
| 145 | db_table = 'publisher_collections' |
|---|
| 146 | ordering = ['value'] |
|---|
| 147 | |
|---|
| 148 | class EthnicGroup(Enumeration): |
|---|
| 149 | "Item ethnic group" |
|---|
| 150 | |
|---|
| 151 | class Meta(MetaEnumeration): |
|---|
| 152 | db_table = 'ethnic_groups' |
|---|
| 153 | verbose_name = _('population / social group') |
|---|
| 154 | |
|---|
| 155 | class EthnicGroupAlias(ModelCore): |
|---|
| 156 | "Item ethnic group other name" |
|---|
| 157 | ethnic_group = ForeignKey('EthnicGroup', related_name="aliases", verbose_name=_('population / social group')) |
|---|
| 158 | value = CharField(_('name'), required=True) |
|---|
| 159 | |
|---|
| 160 | class Meta(MetaCore): |
|---|
| 161 | db_table = 'ethnic_group_aliases' |
|---|
| 162 | unique_together = (('ethnic_group', 'value'),) |
|---|
| 163 | ordering = ['ethnic_group__value'] |
|---|
| 164 | |
|---|
| 165 | # Tape formats |
|---|
| 166 | class WheelDiameter(Enumeration): |
|---|
| 167 | "Tape wheel diameter (cm)" |
|---|
| 168 | |
|---|
| 169 | class Meta(MetaEnumeration): |
|---|
| 170 | db_table = 'tape_wheel_diameter' |
|---|
| 171 | verbose_name = _("tape wheel diameter (cm)") |
|---|
| 172 | |
|---|
| 173 | class TapeLength(Enumeration): |
|---|
| 174 | "Tape length (cm)" |
|---|
| 175 | |
|---|
| 176 | class Meta(MetaEnumeration): |
|---|
| 177 | db_table = 'tape_length' |
|---|
| 178 | verbose_name = _("tape length (cm)") |
|---|
| 179 | |
|---|
| 180 | class TapeWidth(Enumeration): |
|---|
| 181 | "Tape width (inch)" |
|---|
| 182 | |
|---|
| 183 | class Meta(MetaEnumeration): |
|---|
| 184 | db_table = 'tape_width' |
|---|
| 185 | verbose_name = _("tape width (inch)") |
|---|
| 186 | |
|---|
| 187 | class TapeSpeed(Enumeration): |
|---|
| 188 | "Tape speed (m/s)" |
|---|
| 189 | |
|---|
| 190 | class Meta(MetaEnumeration): |
|---|
| 191 | db_table = 'tape_speed' |
|---|
| 192 | verbose_name = _("tape speed (m/s)") |
|---|
| 193 | |
|---|
| 194 | class TapeVendor(Enumeration): |
|---|
| 195 | "Tape vendor" |
|---|
| 196 | |
|---|
| 197 | class Meta(MetaEnumeration): |
|---|
| 198 | db_table = 'tape_vendor' |
|---|
| 199 | verbose_name = _("tape vendor") |
|---|
| 200 | |
|---|
| 201 | class OriginalFormat(Enumeration): |
|---|
| 202 | "Original format" |
|---|
| 203 | |
|---|
| 204 | class Meta(MetaEnumeration): |
|---|
| 205 | db_table = 'original_format' |
|---|
| 206 | verbose_name = _("original format") |
|---|
| 207 | |
|---|