papiez_ipsum/papiezator/models.py

25 lines
730 B
Python

from django.db import models
decimal_places = 3
class Pope(models.Model):
path = models.CharField(max_length=200)
width = models.IntegerField()
height = models.IntegerField()
aspect_ratio = models.DecimalField(max_digits=6, decimal_places=decimal_places)
pope_version = models.ForeignKey('PopeVersion')
def __str__(self):
return self.path.split('/')[-1]
class PopeVersion(models.Model):
pope_id = models.AutoField(primary_key=True)
pope_name = models.CharField(max_length=200)
def __str__(self):
return self.pope_name
class PerfectPope(models.Model):
aspect_ratio = models.DecimalField(max_digits=6, decimal_places=decimal_places)
pope = models.ForeignKey('Pope')