Source code for mg.metadata.camera_info.models

# MG_GPL_HEADER_BEGIN
# 
# This file is part of Media Gallery, GNU GPLv2.
# 
# Media Gallery is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
# 
# Media Gallery is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with Media Gallery; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# 
# MG_GPL_HEADER_END

__author__ = "Media Gallery contributors <mg@lists.ssji.net>"
__copyright__ = "(c) 2010"
__credits__ = ["Dimitri Refauvelet", "Nicolas Pouillon"]

from django.db import models

from mg.core.element.models import Element

__all__ = ['Camera', 'Lens', 'CameraInfo']

class Camera(models.Model):
[docs] maker = models.CharField(max_length = 32, db_index = True) model = models.CharField(max_length = 32, db_index = True) scale_to_35mm = models.FloatField(db_index = True, null = True, blank = True) class Meta: unique_together = ( ("maker", "model"), ) def __unicode__(self): return "%s %s"%(self.maker, self.model) class Lens(models.Model):
[docs] maker = models.CharField(max_length = 32, db_index = True) model = models.CharField(max_length = 32, db_index = True) focal_length_min = models.FloatField(db_index = True, null = True, blank = True) focal_length_max = models.FloatField(db_index = True, null = True, blank = True) aperture_min = models.FloatField(db_index = True, null = True, blank = True) aperture_max = models.FloatField(db_index = True, null = True, blank = True) built_in = models.ForeignKey(Camera, blank = True, null = True, default = None, unique = True) class Meta: unique_together = ( ("maker", "model"), ) def __unicode__(self): return "%s %s %d-%d"%( self.maker, self.model, int(self.focal_length_min), int(self.focal_length_max), ) class CameraInfo(models.Model):
[docs] element = models.OneToOneField(Element) # Hardware camera = models.ForeignKey(Camera, null = True, blank = True) lens = models.ForeignKey(Lens, null = True, blank = True) owner = models.CharField(max_length = 32, db_index = True, null = True, blank = True) serial = models.CharField(max_length = 32, db_index = True, null = True, blank = True) def __unicode__(self): return "<Camera data for %s>"%(self.element)