Skip to content

Commit

Permalink
Remove unused CountryField
Browse files Browse the repository at this point in the history
  • Loading branch information
robhudson committed Jul 26, 2024
1 parent 2f4aac7 commit fdede67
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 22 deletions.
19 changes: 0 additions & 19 deletions basket/news/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,9 @@

from product_details import product_details

from basket.news.country_codes import SFDC_COUNTRIES

ENGLISH_LANGUAGE_CHOICES = sorted(
[(key, f"{key} ({value['English']})") for key, value in product_details.languages.items()],
)
COUNTRY_CHOICES = sorted(
[(key, f"{key} ({value})") for key, value in SFDC_COUNTRIES.items()],
)


class CountryField(models.CharField):
description = "CharField for storing a country code."

def __init__(self, *args, **kwargs):
defaults = {
"max_length": 3,
"choices": COUNTRY_CHOICES,
}
for key, value in defaults.items():
kwargs.setdefault(key, value)

super().__init__(*args, **kwargs)


class LocaleField(models.CharField):
Expand Down
2 changes: 1 addition & 1 deletion basket/news/migrations/0013_auto_20170907_1216.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class Migration(migrations.Migration):
),
(
"country",
basket.news.fields.CountryField(
models.CharField(
default="us",
max_length=3,
choices=[
Expand Down
2 changes: 1 addition & 1 deletion basket/news/migrations/0016_auto_20190515_1951.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name="localizedsmsmessage",
name="country",
field=basket.news.fields.CountryField(
field=models.CharField(
choices=[
("ad", "ad (Andorra)"),
("ae", "ae (United Arab Emirates)"),
Expand Down
2 changes: 1 addition & 1 deletion basket/news/migrations/0017_auto_20190627_2116.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name="localizedsmsmessage",
name="country",
field=basket.news.fields.CountryField(
field=models.CharField(
choices=[
("ad", "ad (Andorra)"),
("ae", "ae (United Arab Emirates)"),
Expand Down

0 comments on commit fdede67

Please sign in to comment.