]> git.parisson.com Git - telemeta.git/commitdiff
add notes to all enumerations, add sound check for collections in corpus
authorGuillaume Pellerin <yomguy@parisson.com>
Tue, 17 Dec 2013 19:00:28 +0000 (20:00 +0100)
committerGuillaume Pellerin <yomguy@parisson.com>
Tue, 17 Dec 2013 19:00:28 +0000 (20:00 +0100)
example/sandbox/settings.py
setup.py
telemeta/models/enum.py
telemeta/templates/telemeta/inc/children_list.html
telemeta/views/admin.py

index 0a38030063433b590fea2e4860526349361dd159..ddaf6e0aa3ef69394f145ab0127f6ec8d500f276 100644 (file)
@@ -129,6 +129,7 @@ INSTALLED_APPS = (
     'jsonrpc',
     'south',
     'sorl.thumbnail',
+    'notes',
 )
 
 TEMPLATE_CONTEXT_PROCESSORS = (
index 6f99c5508d157dd8c4932410cd23c28dc0165e62..ca155e6f9ef654d04bd9f94b3af5d601aa7e233e 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -21,6 +21,7 @@ setup(
         'sorl-thumbnail',
         'django-extensions',
         'docutils',
+        'django-notes',
   ],
   platforms=['OS Independent'],
   license='CeCILL v2',
index a9841f1cc7eda1a607b56026c6fccf10ab967b8f..d65e19591c785ed2cb8b37ce4479548c95e6503a 100644 (file)
@@ -35,6 +35,9 @@
 
 from telemeta.models.core import *
 from django.utils.translation import ugettext_lazy as _
+from django.contrib.contenttypes import generic
+from notes.models import Note
+
 
 class Enumeration(ModelCore):
     "Abstract enumerations base class"
@@ -52,6 +55,8 @@ class MetaEnumeration(MetaCore):
 class PhysicalFormat(Enumeration):
     "Collection physical format"
 
+    notes = generic.GenericRelation(Note)
+
     class Meta(MetaEnumeration):
         db_table = 'physical_formats'
         verbose_name = _("archive format")
@@ -59,6 +64,8 @@ class PhysicalFormat(Enumeration):
 class PublishingStatus(Enumeration):
     "Collection publishing status"
 
+    notes = generic.GenericRelation(Note)
+
     class Meta(MetaEnumeration):
         db_table = 'publishing_status'
         verbose_name = _("secondary edition")
@@ -66,12 +73,16 @@ class PublishingStatus(Enumeration):
 class AcquisitionMode(Enumeration):
     "Mode of acquisition of the collection"
 
+    notes = generic.GenericRelation(Note)
+
     class Meta(MetaEnumeration):
         db_table = 'acquisition_modes'
         verbose_name = _("mode of acquisition")
 
 class MetadataAuthor(Enumeration):
     "Collection metadata author"
+    
+    notes = generic.GenericRelation(Note)
 
     class Meta(MetaEnumeration):
         db_table = 'metadata_authors'
@@ -80,6 +91,8 @@ class MetadataAuthor(Enumeration):
 class MetadataWriter(Enumeration):
     "Collection metadata writer"
 
+    notes = generic.GenericRelation(Note)
+
     class Meta(MetaEnumeration):
         db_table = 'metadata_writers'
         verbose_name = _("record writer")
@@ -87,6 +100,8 @@ class MetadataWriter(Enumeration):
 class LegalRight(Enumeration):
     "Collection legal rights"
 
+    notes = generic.GenericRelation(Note)
+
     class Meta(MetaEnumeration):
         db_table = 'legal_rights'
         verbose_name = _("legal rights")
@@ -94,6 +109,8 @@ class LegalRight(Enumeration):
 class RecordingContext(Enumeration):
     "Collection recording context"
 
+    notes = generic.GenericRelation(Note)
+
     class Meta(MetaEnumeration):
         db_table = 'recording_contexts'
         verbose_name = _("recording context")
@@ -101,6 +118,8 @@ class RecordingContext(Enumeration):
 class AdConversion(Enumeration):
     "Collection digital to analog conversion status"
 
+    notes = generic.GenericRelation(Note)
+
     class Meta(MetaEnumeration):
         db_table = 'ad_conversions'
         verbose_name = _("A/D conversion")
@@ -108,6 +127,8 @@ class AdConversion(Enumeration):
 class VernacularStyle(Enumeration):
     "Item vernacular style"
 
+    notes = generic.GenericRelation(Note)
+
     class Meta(MetaEnumeration):
         db_table = 'vernacular_styles'
         verbose_name = _("vernacular style")
@@ -115,6 +136,8 @@ class VernacularStyle(Enumeration):
 class GenericStyle(Enumeration):
     "Item generic style"
 
+    notes = generic.GenericRelation(Note)
+
     class Meta(MetaEnumeration):
         db_table = 'generic_styles'
         verbose_name = _("generic style")
@@ -122,6 +145,8 @@ class GenericStyle(Enumeration):
 class ContextKeyword(Enumeration):
     "Keyword"
 
+    notes = generic.GenericRelation(Note)
+
     class Meta(MetaEnumeration):
         db_table = 'context_keywords'
         verbose_name = _("keyword")
@@ -129,14 +154,19 @@ class ContextKeyword(Enumeration):
 class Publisher(Enumeration):
     "Collection publisher"
 
+    notes = generic.GenericRelation(Note)
+
     class Meta(MetaEnumeration):
         db_table = 'publishers'
         verbose_name = _("publisher / status")
 
+
 class PublisherCollection(ModelCore):
     "Collection which belongs to publisher"
+    
     publisher = ForeignKey('Publisher', related_name="publisher_collections", verbose_name=_('publisher'))
     value     = CharField(_('value'), required=True)
+    notes     = generic.GenericRelation(Note)
 
     def __unicode__(self):
         return self.value
@@ -145,17 +175,23 @@ class PublisherCollection(ModelCore):
         db_table = 'publisher_collections'
         ordering = ['value']
 
+
 class EthnicGroup(Enumeration):
     "Item ethnic group"
 
+    notes = generic.GenericRelation(Note)
+
     class Meta(MetaEnumeration):
         db_table = 'ethnic_groups'
         verbose_name = _('population / social group')
 
+
 class EthnicGroupAlias(ModelCore):
     "Item ethnic group other name"
+    
     ethnic_group = ForeignKey('EthnicGroup', related_name="aliases", verbose_name=_('population / social group'))
     value        = CharField(_('name'), required=True)
+    notes        = generic.GenericRelation(Note)
 
     class Meta(MetaCore):
         db_table = 'ethnic_group_aliases'
index a15a4cf8e3a7ba4e1ca9b718a9eb2ce2dedbc8bc..d20b25f15a798b543314e361bcb17bfab26e4a4c 100644 (file)
@@ -16,6 +16,7 @@
     <th>{% trans "Description" %}</th>
     <th>{% trans "Code" %}</th>
     <th>{% trans "Reference" %}</th>
+    <th>{% trans "Sound" %}</th>
 </tr>
 {% for child in children %}
 {% if child.code %}
     <td>{{ child.description }}</td>
     <td>{{ child.code }}</td>
     <td>{{ child.reference }}</td>
+    <td>
+      {% if child.has_mediafile %}
+       <img src="{{ STATIC_URL }}telemeta/images/ok.png" alt="yes" style="vertical-align:middle" />
+      {% endif %}
+    </td>
 </tr>
 {% endif %}
 {% endfor %}
index f3b37c21065e993ce4aab1514b34e12caf364a4a..62fae36a1f1944083f43b5170f76bfd36c13f91f 100644 (file)
@@ -130,11 +130,14 @@ class AdminView(object):
         if enumeration == None:
             raise Http404
 
+        record = enumeration.objects.get(id__exact=value_id)
+        
         vars = self.__get_admin_context_vars()
         vars["enumeration_id"] = enumeration._meta.module_name
         vars["enumeration_name"] = enumeration._meta.verbose_name
-        vars["enumeration_record"] = enumeration.objects.get(id__exact=value_id)
+        vars["enumeration_record"] = record
         vars["enumeration_records"] = enumeration.objects.all()
+        vars["enumeration_notes"] = record.notes.all()
 
         return render(request, 'telemeta/enumeration_edit_value.html', vars)