Changeset 2444cce


Ignore:
Timestamp:
05/02/12 10:54:02 (2 years ago)
Author:
yomguy <yomguy@…>
Branches:
master, crem, crem2, dev, dev2, diadems, feature/breadcrumbs, feature/ts-0.5, feature/ts-0.5.4, feature/writecache, generic, instru_search, lam, lam2, mapsv3, merge, nlivemulti, production, release/1.4.4, sabiod, security, server, social, storage, telecaster, test
Children:
c8cdfbe
Parents:
3e16749
git-author:
yomguy <yomguy@…> (05/02/12 10:54:02)
git-committer:
yomguy <yomguy@…> (05/02/12 10:54:02)
Message:

fix Format (LAM) and enums, linked in item

Location:
telemeta
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • telemeta/models/__init__.py

    r44cc478 r2444cce  
    4343from dublincore import * 
    4444from language import * 
     45from format import * 
    4546 
  • telemeta/models/enum.py

    r7ed402e r2444cce  
    164164 
    165165# Tape formats 
     166class 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 
    166173class TapeLength(Enumeration): 
    167174    "Tape length (cm)" 
     
    192199        verbose_name = _("tape vendor") 
    193200 
     201class OriginalFormat(Enumeration): 
     202    "Original format" 
     203 
     204    class Meta(MetaEnumeration): 
     205        db_table = 'original_format' 
     206        verbose_name = _("original format") 
     207 
  • telemeta/models/media.py

    rfad4d14 r2444cce  
    5050from telemeta.models.enum import * 
    5151from telemeta.models.language import * 
     52from telemeta.models.format import * 
    5253from django.db import models 
    5354 
     
    347348    track                 = CharField(_('item number')) 
    348349    creator_reference     = CharField(_('reference')) 
     350    original_format       = ForeignKey(Format, related_name="item", 
     351                                       verbose_name=_('orinal format'), blank=True, 
     352                                        null=True, on_delete=models.SET_NULL) 
    349353    external_references   = TextField(_('published references')) 
    350354    copied_from_item      = WeakForeignKey('self', related_name="copies", verbose_name=_('copy of')) 
     
    676680        verbose_name_plural = _('fonds related media') 
    677681 
    678  
    679 class Format(ModelCore): 
    680     """ Physical format object as proposed by the LAM""" 
    681  
    682     item = ForeignKey(MediaItem, related_name="formats", verbose_name=_('item')) 
    683     original_code = CharField(_('original code'), required=True) 
    684     tape_number = CharField(_('tape number')) 
    685     status = CharField(_('status')) 
    686     conservation_state = CharField(_('conservation state')) 
    687     comments = TextField(_('comments')) 
    688  
    689     tape_length = WeakForeignKey(TapeLength, related_name="formats", verbose_name = _("tape length (cm)")) 
    690     tape_width  = WeakForeignKey(TapeWidth, related_name="formats", verbose_name = _("tape width (inch)")) 
    691     tape_speed = WeakForeignKey(TapeSpeed, related_name="formats", verbose_name = _("tape speed (m/s)")) 
    692     tape_vendor = WeakForeignKey(TapeVendor, related_name="formats") 
    693     tape_thickness = CharField(_('tape thickness (um)')) 
    694     tape_diameter = CharField(_('tape diameter (mm)')) 
    695     tape_reference = CharField(_('tape reference')) 
    696  
    697     class Meta(MetaCore): 
    698         db_table = 'media_formats' 
    699         verbose_name = _('format') 
    700  
    701     def __unicode__(self): 
    702         return self.original_code 
    703  
    704     @property 
    705     def public_id(self): 
    706         return self.original_code 
    707  
  • telemeta/views/base.py

    r3e16749 r2444cce  
    657657            last_revision = None 
    658658 
    659         physical_format = Format.objects.filter(item=item) 
    660         if physical_format: 
    661             physical_format = physical_format[0] 
     659        physical_format = item.format.physical_format 
    662660 
    663661        return render(request, template, 
Note: See TracChangeset for help on using the changeset viewer.