Template
Closes #9. Shop-gated buyer accounts, purchase reviews, Stripe customer ids, shipment tracking, slim public contact form, and a template-neutral seed_demo command.
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
from django.conf import settings
|
|
from django.db import models
|
|
|
|
from core.models import TimeStampedModel
|
|
|
|
|
|
class RealtorProfile(TimeStampedModel):
|
|
user = models.OneToOneField(
|
|
settings.AUTH_USER_MODEL,
|
|
on_delete=models.CASCADE,
|
|
related_name="realtor_profile",
|
|
)
|
|
display_name = models.CharField(max_length=120, blank=True)
|
|
phone = models.CharField(max_length=32, blank=True)
|
|
title = models.CharField(max_length=120, blank=True)
|
|
bio = models.TextField(blank=True)
|
|
|
|
def __str__(self) -> str:
|
|
return self.display_name or self.user.get_username()
|
|
|
|
|
|
class CustomerProfile(TimeStampedModel):
|
|
"""Shop-buyer profile. Card numbers stay on Stripe; we only keep the customer id."""
|
|
|
|
user = models.OneToOneField(
|
|
settings.AUTH_USER_MODEL,
|
|
on_delete=models.CASCADE,
|
|
related_name="customer_profile",
|
|
)
|
|
phone = models.CharField(max_length=32, blank=True)
|
|
shipping_address = models.JSONField(default=dict, blank=True)
|
|
stripe_customer_id = models.CharField(max_length=255, blank=True)
|
|
|
|
def __str__(self) -> str:
|
|
return self.user.get_username()
|