2022-08-09 06:27:55 +00:00
|
|
|
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.
|
|
|
|
"""
|
|
|
|
|
2022-08-09 07:33:26 +00:00
|
|
|
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)
|
|
|
|
|
2022-08-09 06:27:55 +00:00
|
|
|
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 ZipPlaces(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())
|