-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/0.3.42' into main
- Loading branch information
Showing
7 changed files
with
51 additions
and
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,12 @@ | ||
import sys | ||
|
||
from django.apps import AppConfig as DjangoAppConfig | ||
from django.core.management.color import color_style | ||
from django.db.models.signals import post_migrate | ||
|
||
from .site import get_autodiscover_sites, sites | ||
|
||
style = color_style() | ||
|
||
|
||
def post_migrate_update_sites(sender=None, **kwargs): | ||
from edc_sites.utils import add_or_update_django_sites | ||
|
||
sys.stdout.write(style.MIGRATE_HEADING("Updating sites:\n")) | ||
|
||
for country in sites.countries: | ||
sys.stdout.write(style.MIGRATE_HEADING(f" (*) sites for {country} ...\n")) | ||
add_or_update_django_sites(verbose=True) | ||
sys.stdout.write("Done.\n") | ||
sys.stdout.flush() | ||
|
||
|
||
class AppConfig(DjangoAppConfig): | ||
name = "edc_sites" | ||
verbose_name = "Edc Sites" | ||
has_exportable_data = True | ||
default_auto_field = "django.db.models.BigAutoField" | ||
include_in_administration_section = True | ||
|
||
def ready(self): | ||
if get_autodiscover_sites(): | ||
post_migrate.connect(post_migrate_update_sites, sender=self) | ||
sys.stdout.write(f"Loading {self.verbose_name} ...\n") | ||
sites.autodiscover() |
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,18 @@ | ||
import sys | ||
|
||
from django.core.management.color import color_style | ||
|
||
style = color_style() | ||
|
||
|
||
def post_migrate_update_sites(sender=None, **kwargs): | ||
from .site import sites as site_sites | ||
from .utils import add_or_update_django_sites | ||
|
||
sys.stdout.write(style.MIGRATE_HEADING("Updating sites:\n")) | ||
|
||
for country in site_sites.countries: | ||
sys.stdout.write(style.MIGRATE_HEADING(f" (*) sites for {country} ...\n")) | ||
add_or_update_django_sites(verbose=True) | ||
sys.stdout.write("Done.\n") | ||
sys.stdout.flush() |
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