<reponame>OrenBen-Meir/Meal-Spot<gh_stars>0
from django.db import models
from django.core.validators import MaxValueValidator

class Address(models.Model):
    STATE_CHOICES = [
        ('--', 'State'),
        ('AL', 'Alabama'),
        ('AK', 'Alaska'),
        ('AZ', 'Arizona'),
        ('AR', 'Arkansas'),
        ('CA', 'California'),
        ('CO', 'Colorado'),
        ('CT', 'Connecticut'),
        ('DE', 'Delaware'),
        ('FL', 'Florida'),
        ('GA', 'Georgia'),
        ('HI', 'Hawaii'),
        ('ID', 'Idaho'),
        ('IL', 'Illinois'),
        ('IN', 'Indiana'),
        ('IA', 'Iowa'),
        ('KS', 'Kansas'),
        ('KY', 'Kentucky'),
        ('LA', 'Louisiana'),
        ('ME', 'Maine'),
        ('MD', 'Maryland'),
        ('MA', 'Massachusetts'),
        ('MI', 'Michigan'),
        ('MN', 'Minnesota'),
        ('MS', 'Mississippi'),
        ('MO', 'Missouri'),
        ('MT', 'Montana'),
        ('NE', 'Nebraska'),
        ('NV', 'Nevada'),
        ('NH', 'New Hampshire'),
        ('NJ', 'New Jersey'),
        ('NM', 'New Mexico'),
        ('NY', 'New York'),
        ('NC', 'North Carolina'),
        ('ND', 'North Dakotsa'),
        ('OH', 'Ohio'),
        ('OK', 'Oklahoma'),
        ('OR', 'Oregon'),
        ('PA', 'Pennsylvania'),
        ('RI', 'Rhode Island'),
        ('SC', 'South Carolina'),
        ('SD', 'South Dakota'),
        ('TN', 'Tennessee'),
        ('TX', 'Texas'),
        ('UT', 'Utah'),
        ('VT', 'Vermont'),
        ('VA', 'Virginia'),
        ('WA', 'Washington'),
        ('WV', 'West Virginia'),
        ('WI', 'Wisconsin'),
        ('WY', 'Wyoming')
    ]
    street_address = models.TextField()
    apt = models.CharField(max_length=10, default=None, blank=True, null=True)
    city = models.CharField(max_length=50)
    state = models.CharField(
        max_length=2,
        choices=STATE_CHOICES,
        default='--',
    )
    zip_code = models.IntegerField(validators=[MaxValueValidator(99999)]) 

class CustomerAddress(Address):
    customer = models.ForeignKey('Customer', on_delete=models.CASCADE)
    default = models.BooleanField(default=False)
    def __str__(self):
        return str(self.customer)+' addresss'

class RestaurantAddress(Address):
    restaurant = models.ForeignKey('Restaurant', on_delete=models.CASCADE)
    def __str__(self):
        return str(self.restaurant)+' addresss'
from django.db import models
from django.core.validators import MaxValueValidator

class Address(models.Model):
    STATE_CHOICES = [
        ('--', 'State'),
        ('AL', 'Alabama'),
        ('AK', 'Alaska'),
        ('AZ', 'Arizona'),
        ('AR', 'Arkansas'),
        ('CA', 'California'),
        ('CO', 'Colorado'),
        ('CT', 'Connecticut'),
        ('DE', 'Delaware'),
        ('FL', 'Florida'),
        ('GA', 'Georgia'),
        ('HI', 'Hawaii'),
        ('ID', 'Idaho'),
        ('IL', 'Illinois'),
        ('IN', 'Indiana'),
        ('IA', 'Iowa'),
        ('KS', 'Kansas'),
        ('KY', 'Kentucky'),
        ('LA', 'Louisiana'),
        ('ME', 'Maine'),
        ('MD', 'Maryland'),
        ('MA', 'Massachusetts'),
        ('MI', 'Michigan'),
        ('MN', 'Minnesota'),
        ('MS', 'Mississippi'),
        ('MO', 'Missouri'),
        ('MT', 'Montana'),
        ('NE', 'Nebraska'),
        ('NV', 'Nevada'),
        ('NH', 'New Hampshire'),
        ('NJ', 'New Jersey'),
        ('NM', 'New Mexico'),
        ('NY', 'New York'),
        ('NC', 'North Carolina'),
        ('ND', 'North Dakotsa'),
        ('OH', 'Ohio'),
        ('OK', 'Oklahoma'),
        ('OR', 'Oregon'),
        ('PA', 'Pennsylvania'),
        ('RI', 'Rhode Island'),
        ('SC', 'South Carolina'),
        ('SD', 'South Dakota'),
        ('TN', 'Tennessee'),
        ('TX', 'Texas'),
        ('UT', 'Utah'),
        ('VT', 'Vermont'),
        ('VA', 'Virginia'),
        ('WA', 'Washington'),
        ('WV', 'West Virginia'),
        ('WI', 'Wisconsin'),
        ('WY', 'Wyoming')
    ]
    street_address = models.TextField()
    apt = models.CharField(max_length=10, default=None, blank=True, null=True)
    city = models.CharField(max_length=50)
    state = models.CharField(
        max_length=2,
        choices=STATE_CHOICES,
        default='--',
    )
    zip_code = models.IntegerField(validators=[MaxValueValidator(99999)]) 

class CustomerAddress(Address):
    customer = models.ForeignKey('Customer', on_delete=models.CASCADE)
    default = models.BooleanField(default=False)
    def __str__(self):
        return str(self.customer)+' addresss'

class RestaurantAddress(Address):
    restaurant = models.ForeignKey('Restaurant', on_delete=models.CASCADE)
    def __str__(self):
        return str(self.restaurant)+' addresss'