2016-04-10 21:12:43 +00:00
|
|
|
from django.db import models
|
|
|
|
|
2016-04-26 06:16:03 +00:00
|
|
|
from .fields import CountryField
|
|
|
|
|
2016-04-10 21:12:43 +00:00
|
|
|
# Create your models here.
|
|
|
|
|
|
|
|
|
2016-04-26 06:16:03 +00:00
|
|
|
class BillingAddress(models.Model):
|
|
|
|
street_address = models.CharField(max_length=100)
|
|
|
|
city = models.CharField(max_length=50)
|
|
|
|
postal_code = models.CharField(max_length=50)
|
|
|
|
country = CountryField()
|
|
|
|
|
2016-05-11 10:02:35 +00:00
|
|
|
def __str__(self):
|
|
|
|
"""
|
|
|
|
str cast with a friendly representation of the BillingAddress object
|
|
|
|
"""
|
|
|
|
return "%s %s %s %s" % (self.street_address, self.city, self.postal_code, self.country)
|
2016-04-26 06:16:03 +00:00
|
|
|
|
|
|
|
|
2016-04-10 21:12:43 +00:00
|
|
|
class ContactMessage(models.Model):
|
|
|
|
name = models.CharField(max_length=200)
|
|
|
|
email = models.EmailField()
|
|
|
|
phone_number = models.CharField(max_length=200)
|
|
|
|
message = models.TextField()
|
|
|
|
received_date = models.DateTimeField(auto_now_add=True)
|
|
|
|
|
|
|
|
def __str__(self):
|
2016-05-11 10:02:35 +00:00
|
|
|
"""
|
|
|
|
str cast with a friendly representation of the ContactMessage object
|
|
|
|
"""
|
2016-04-26 06:16:03 +00:00
|
|
|
return "%s - %s - %s" % (self.name, self.email, self.received_date)
|