This repository has been archived by the owner on Jun 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1013 from yverdon/feature/yc-1210
YC-1210: Add country to user profile and contacts
- Loading branch information
Showing
29 changed files
with
303 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
geocity/apps/accounts/migrations/0020_historicaluserprofile_country_userprofile_country.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Generated by Django 4.2.11 on 2024-05-29 09:09 | ||
|
||
import django_countries.fields | ||
from django.db import migrations | ||
|
||
|
||
def set_country_to_null(apps, schema_editor): | ||
UserProfile = apps.get_model("accounts", "UserProfile") | ||
HistoricalUserProfile = apps.get_model("accounts", "HistoricalUserProfile") | ||
|
||
UserProfile.objects.all().update(country=None) | ||
HistoricalUserProfile.objects.all().update(country=None) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("accounts", "0019_administrativeentity_agenda_domain"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="historicaluserprofile", | ||
name="country", | ||
field=django_countries.fields.CountryField( | ||
default="CH", max_length=2, null=True, verbose_name="Pays" | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="userprofile", | ||
name="country", | ||
field=django_countries.fields.CountryField( | ||
default="CH", max_length=2, null=True, verbose_name="Pays" | ||
), | ||
), | ||
# Dont add the default value to the existing users | ||
migrations.RunPython(set_country_to_null), | ||
] |
97 changes: 97 additions & 0 deletions
97
geocity/apps/accounts/migrations/0021_alter_administrativeentity_phone_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# Generated by Django 4.2.11 on 2024-05-30 08:58 | ||
|
||
import django.core.validators | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("accounts", "0020_historicaluserprofile_country_userprofile_country"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="administrativeentity", | ||
name="phone", | ||
field=models.CharField( | ||
blank=True, | ||
max_length=20, | ||
validators=[ | ||
django.core.validators.RegexValidator( | ||
message="Seuls les chiffres et les espaces sont autorisés.", | ||
regex="^(?:\\+(?:[0-9] ?){6,14}[0-9]|0\\d(?: ?\\d){8,13})$", | ||
) | ||
], | ||
verbose_name="Téléphone", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="historicaluserprofile", | ||
name="phone_first", | ||
field=models.CharField( | ||
max_length=20, | ||
validators=[ | ||
django.core.validators.RegexValidator( | ||
message="Seuls les chiffres et les espaces sont autorisés.", | ||
regex="^(?:\\+(?:[0-9] ?){6,14}[0-9]|0\\d(?: ?\\d){8,13})$", | ||
) | ||
], | ||
verbose_name="Téléphone principal", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="historicaluserprofile", | ||
name="phone_second", | ||
field=models.CharField( | ||
blank=True, | ||
max_length=20, | ||
validators=[ | ||
django.core.validators.RegexValidator( | ||
message="Seuls les chiffres et les espaces sont autorisés.", | ||
regex="^(?:\\+(?:[0-9] ?){6,14}[0-9]|0\\d(?: ?\\d){8,13})$", | ||
) | ||
], | ||
verbose_name="Téléphone secondaire", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="historicaluserprofile", | ||
name="zipcode", | ||
field=models.PositiveIntegerField(verbose_name="Code postal"), | ||
), | ||
migrations.AlterField( | ||
model_name="userprofile", | ||
name="phone_first", | ||
field=models.CharField( | ||
max_length=20, | ||
validators=[ | ||
django.core.validators.RegexValidator( | ||
message="Seuls les chiffres et les espaces sont autorisés.", | ||
regex="^(?:\\+(?:[0-9] ?){6,14}[0-9]|0\\d(?: ?\\d){8,13})$", | ||
) | ||
], | ||
verbose_name="Téléphone principal", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="userprofile", | ||
name="phone_second", | ||
field=models.CharField( | ||
blank=True, | ||
max_length=20, | ||
validators=[ | ||
django.core.validators.RegexValidator( | ||
message="Seuls les chiffres et les espaces sont autorisés.", | ||
regex="^(?:\\+(?:[0-9] ?){6,14}[0-9]|0\\d(?: ?\\d){8,13})$", | ||
) | ||
], | ||
verbose_name="Téléphone secondaire", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="userprofile", | ||
name="zipcode", | ||
field=models.PositiveIntegerField(verbose_name="Code postal"), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -451,6 +451,7 @@ class Meta: | |
"zipcode", | ||
"user_id", | ||
"city", | ||
"country", | ||
"company_name", | ||
"vat_number", | ||
"iban", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.