forked from botswana-harvard/edc-action-item
-
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.
move post migrate signals and autodiscover to edc_appconfig
- Loading branch information
Showing
8 changed files
with
30 additions
and
31 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,29 +1,11 @@ | ||
import sys | ||
|
||
from django.apps import AppConfig as DjangoApponfig | ||
from django.core.management.color import color_style | ||
from django.db.models.signals import post_migrate | ||
|
||
from .site_action_items import site_action_items | ||
|
||
style = color_style() | ||
|
||
|
||
def update_action_types(sender=None, verbose=None, **kwargs): # noqa | ||
sys.stdout.write(style.MIGRATE_HEADING("Updating action types:\n")) | ||
site_action_items.create_or_update_action_types() | ||
sys.stdout.write("Done.\n") | ||
sys.stdout.flush() | ||
|
||
|
||
class AppConfig(DjangoApponfig): | ||
name = "edc_action_item" | ||
verbose_name = "Action Items" | ||
has_exportable_data = True | ||
include_in_administration_section = True | ||
|
||
def ready(self): | ||
post_migrate.connect(update_action_types, sender=self) | ||
sys.stdout.write(f"Loading {self.verbose_name} ...\n") | ||
site_action_items.autodiscover() | ||
sys.stdout.write(f" Done loading {self.verbose_name}.\n") |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import sys | ||
|
||
from django.core.management.color import color_style | ||
|
||
style = color_style() | ||
|
||
|
||
def update_action_types(sender=None, verbose=None, **kwargs): # noqa | ||
from .site_action_items import site_action_items | ||
|
||
sys.stdout.write(style.MIGRATE_HEADING("Updating action types:\n")) | ||
site_action_items.create_or_update_action_types() | ||
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