22 lines
714 B
Python
22 lines
714 B
Python
|
from django.db import models
|
||
|
from django.contrib.auth import get_user_model
|
||
|
|
||
|
from localauth.models import PersonMixin, AddressMixin
|
||
|
|
||
|
class BillingAddress(PersonMixin, AddressMixin):
|
||
|
user = models.ForeignKey(get_user_model(), models.CASCADE)
|
||
|
|
||
|
@classmethod
|
||
|
def from_profile(cls, profile):
|
||
|
return cls.objects.create(
|
||
|
company = profile.company,
|
||
|
vat_id = profile.vat_id,
|
||
|
first_name = profile.first_name,
|
||
|
last_name = profile.last_name,
|
||
|
street = profile.street,
|
||
|
city = profile.city,
|
||
|
zip = profile.zip,
|
||
|
state = profile.state,
|
||
|
country = profile.country,
|
||
|
user = profile.user
|
||
|
)
|