from django.db import models DECIMAL_PLACES = 3 class PopeImage(models.Model): id = models.AutoField(primary_key=True) 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): id = models.IntegerField(primary_key=True) name = models.CharField(max_length=200) def __str__(self): return self.name class PerfectPope(models.Model): aspect_ratio = models.FloatField(primary_key=True) image = models.ForeignKey('PopeImage') pope = models.ForeignKey('Pope') def __str__(self): return str(self.aspect_ratio)