papiez_ipsum/src/papiezator/models.py

31 lines
672 B
Python

from django.db import models
DECIMAL_PLACES = 3
class PopeImage(models.Model):
path = models.CharField(max_length=200)
width = models.IntegerField()
height = models.IntegerField()
aspect_ratio = models.FloatField()
pope = models.ForeignKey('Pope')
def __str__(self):
return self.path.split('/')[-1]
class Pope(models.Model):
name = models.CharField(max_length=200)
def __str__(self):
return self.name
class PerfectPope(models.Model):
aspect_ratio = models.FloatField()
image = models.ForeignKey('PopeImage')
pope = models.ForeignKey('Pope')
def __str__(self):
return str(self.aspect_ratio)