from django.db import models from django.conf import settings """BillingUserProfile model for tax calculation. This module defines the BillingUserProfile model that stores user billing address information used for tax calculation purposes. The profile data may also be synchronized with third-party services such as Stripe. The model stores essential address components including: - Country code (ISO 3166-1 alpha-2) - State/province code (ISO 3166-2 when possible) - City - Postal code - Address lines """ class BillingUserProfile(models.Model): user = models.OneToOneField( settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING, primary_key=True, related_name="billing_profile", ) stripe_customer_id = models.CharField(max_length=128, null=True, blank=True) # zip or postal code postal_code = models.CharField(max_length=128, null=True, blank=True) # Two-letter country code ([ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)) country = models.CharField(max_length=8, null=True, blank=True) # City, district, suburb, town, or village city = models.CharField(max_length=128, null=True, blank=True) # State, county, province, or region. We recommend sending [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2) subdivision code value when possible. state = models.CharField(max_length=128, null=True, blank=True) line1 = models.CharField(max_length=128, null=True, blank=True) line2 = models.CharField(max_length=128, null=True, blank=True) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) class Meta: db_table = "billing_user_profiles"