from django.db import models from base64 import b64encode from ..helpers.uploads import get_upload_path """ These models are used by Adonis to return tens of thousands of lines of unneeded data. Not currently needed, but prepared. """ class Country(models.Model): code = models.CharField(max_length=16) text = models.CharField(max_length=128) class Nationality(models.Model): country = models.ForeignKey(Country, models.PROTECT) class Airport(models.Model): city_code = models.CharField(max_length=256, null=True, blank=True) code = models.CharField(max_length=256, null=True, blank=True, unique=True) country_name = models.CharField(max_length=256, null=True, blank=True) name = models.CharField(max_length=256, null=True, blank=True) class ZipPlace(models.Model): postcode = models.CharField(max_length=64) postplace = models.CharField(max_length=256) country = models.ForeignKey(Nationality, models.PROTECT) class PhoneCode(models.Model): code = models.CharField(max_length=16) flag = models.ImageField(null=True, upload_to=get_upload_path) text = models.CharField(max_length=128) @property def flag_base64(self): return b64encode(self.flag.read())