mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-10 20:09:25 +00:00
Add the new 3DSv2 fields
This commit is contained in:
@ -34,6 +34,7 @@ from django.utils import timezone
|
||||
from django.utils.functional import cached_property
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django_countries.fields import CountryField
|
||||
from phonenumber_field.modelfields import PhoneNumberField
|
||||
|
||||
from accounting.models import CurrencyField
|
||||
from club.models import Club
|
||||
@ -176,6 +177,14 @@ class BillingInfo(models.Model):
|
||||
city = models.CharField(_("City"), max_length=50)
|
||||
country = CountryField(blank_label=_("Country"))
|
||||
|
||||
# This table was created during the A22 semester.
|
||||
# However, later on, CA asked for the phone number to be added to the billing info.
|
||||
# As the table was already created, this new field had to be nullable,
|
||||
# even tough it is required by the bank and shouldn't be null.
|
||||
# If one day there is no null phone number remaining,
|
||||
# please make the field non-nullable.
|
||||
phone_number = PhoneNumberField(_("Phone number"), null=True, blank=False)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.first_name} {self.last_name}"
|
||||
|
||||
@ -192,6 +201,8 @@ class BillingInfo(models.Model):
|
||||
"ZipCode": self.zip_code,
|
||||
"City": self.city,
|
||||
"CountryCode": self.country.numeric, # ISO-3166-1 numeric code
|
||||
"MobilePhone": self.phone_number.as_national.replace(" ", ""),
|
||||
"CountryCodeMobilePhone": f"+{self.phone_number.country_code}",
|
||||
}
|
||||
}
|
||||
if self.address_2:
|
||||
|
Reference in New Issue
Block a user