make BillingInfo.phone_number non-nullable

This commit is contained in:
imperosol
2026-06-02 12:54:31 +02:00
parent 30a3911fa1
commit e629b36465
8 changed files with 43 additions and 79 deletions
@@ -15,7 +15,7 @@ class Migration(migrations.Migration):
blank=True,
help_text=(
"If a limit is set, the product won't be purchasable "
"anymore once the latter is reached."
"anymore on the eboutic once the latter is reached."
),
null=True,
verbose_name="clic limit",
@@ -0,0 +1,26 @@
# Generated by Django 5.2.14 on 2026-06-02 10:45
import django_countries.fields
import phonenumber_field.modelfields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("counter", "0040_product_clic_limit")]
operations = [
migrations.AlterField(
model_name="billinginfo",
name="country",
field=django_countries.fields.CountryField(
max_length=2, verbose_name="Country"
),
),
migrations.AlterField(
model_name="billinginfo",
name="phone_number",
field=phonenumber_field.modelfields.PhoneNumberField(
max_length=128, region=None, verbose_name="Phone number"
),
),
]
+2 -9
View File
@@ -228,15 +228,8 @@ class BillingInfo(models.Model):
address_2 = models.CharField(_("Address 2"), max_length=50, blank=True, null=True)
zip_code = models.CharField(_("Zip code"), max_length=16) # code postal
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)
country = CountryField(_("Country"))
phone_number = PhoneNumberField(_("Phone number"))
def __str__(self):
return f"{self.first_name} {self.last_name}"