2013-11-26 22:32:11 +00:00
|
|
|
from django.db import models
|
|
|
|
|
2013-12-23 18:53:20 +00:00
|
|
|
DECIMAL_PLACES = 3
|
2013-11-26 22:32:11 +00:00
|
|
|
|
2014-01-08 04:50:03 +00:00
|
|
|
|
2013-12-23 18:53:20 +00:00
|
|
|
class PopeImage(models.Model):
|
2014-01-10 21:14:58 +00:00
|
|
|
path = models.CharField(max_length=200)
|
2013-11-26 22:32:11 +00:00
|
|
|
width = models.IntegerField()
|
|
|
|
height = models.IntegerField()
|
|
|
|
aspect_ratio = models.FloatField()
|
2013-12-23 18:53:20 +00:00
|
|
|
pope = models.ForeignKey('Pope')
|
2013-11-26 22:32:11 +00:00
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return self.path.split('/')[-1]
|
|
|
|
|
2014-01-08 04:50:03 +00:00
|
|
|
|
2013-12-23 18:53:20 +00:00
|
|
|
class Pope(models.Model):
|
|
|
|
name = models.CharField(max_length=200)
|
2013-11-26 22:32:11 +00:00
|
|
|
|
|
|
|
def __str__(self):
|
2013-12-23 18:53:20 +00:00
|
|
|
return self.name
|
2013-11-26 22:32:11 +00:00
|
|
|
|
2014-01-08 04:50:03 +00:00
|
|
|
|
2013-11-26 22:32:11 +00:00
|
|
|
class PerfectPope(models.Model):
|
2014-03-06 14:08:11 +00:00
|
|
|
aspect_ratio = models.FloatField()
|
2013-12-23 18:53:20 +00:00
|
|
|
image = models.ForeignKey('PopeImage')
|
2013-11-26 22:32:11 +00:00
|
|
|
pope = models.ForeignKey('Pope')
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return str(self.aspect_ratio)
|