-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into ato-documentation
- Loading branch information
Showing
25 changed files
with
480 additions
and
107 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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from django.apps import AppConfig | ||
|
||
class ApiAppConfig(AppConfig): | ||
name = "api" |
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 @@ | ||
# Create your signal connections here. |
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,8 @@ | ||
from django.apps import AppConfig | ||
from .signals import setup_signals | ||
|
||
class EmployeesAppConfig(AppConfig): | ||
name = "employees" | ||
|
||
def ready(self): | ||
setup_signals() |
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,33 @@ | ||
import logging | ||
|
||
from django.db.models.signals import pre_save | ||
|
||
logger = logging.getLogger('tock-employees') | ||
|
||
|
||
def employee_grade_creation(sender, instance=None, **kwargs): | ||
if instance is not None and instance.pk is None: | ||
logger.info( | ||
f'Creating EmployeeGrade for {instance.employee.username}.' | ||
) | ||
|
||
def user_data_creation(sender, instance=None, **kwargs): | ||
if instance is not None and instance.pk is None: | ||
logger.info( | ||
f'Creating UserData for {instance.user.username}.' | ||
) | ||
|
||
|
||
def setup_signals(): | ||
from .models import EmployeeGrade, UserData | ||
|
||
pre_save.connect( | ||
employee_grade_creation, | ||
sender=EmployeeGrade, | ||
dispatch_uid="employees_employee_grade_creation" | ||
) | ||
pre_save.connect( | ||
user_data_creation, | ||
sender=UserData, | ||
dispatch_uid="employees_user_data_creation" | ||
) |
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,8 @@ | ||
from django.apps import AppConfig | ||
from .signals import setup_signals | ||
|
||
class HoursAppConfig(AppConfig): | ||
name = "hours" | ||
|
||
def ready(self): | ||
setup_signals() |
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,97 @@ | ||
import logging | ||
|
||
from django.db.models.signals import pre_save | ||
|
||
logger = logging.getLogger('tock-hours') | ||
|
||
|
||
def holiday_prefills_creation(sender, instance=None, **kwargs): | ||
if instance is not None and instance.pk is None: | ||
logger.info( | ||
f'Creating HolidayPrefills for {instance}.' | ||
) | ||
|
||
|
||
def reporting_period_creation(sender, instance=None, **kwargs): | ||
if instance is not None and instance.pk is None: | ||
logger.info( | ||
f'Creating ReportingPeriod for {instance}.' | ||
) | ||
|
||
|
||
def targets_creation(sender, instance=None, **kwargs): | ||
if instance is not None and instance.pk is None: | ||
logger.info( | ||
f'Creating Targets for {instance}.' | ||
) | ||
|
||
|
||
def timecard_creation(sender, instance=None, **kwargs): | ||
if instance is not None and instance.pk is None: | ||
logger.info( | ||
f'Creating Timecard for {instance}.' | ||
) | ||
|
||
|
||
def timecard_note_creation(sender, instance=None, **kwargs): | ||
if instance is not None and instance.pk is None: | ||
logger.info( | ||
f'Creating TimecardNote for {instance}.' | ||
) | ||
|
||
|
||
def timecard_object_creation(sender, instance=None, **kwargs): | ||
if instance is not None and instance.pk is None: | ||
logger.info( | ||
f'Creating TimecardObject for {instance}.' | ||
) | ||
|
||
|
||
def timecard_prefill_data_creation(sender, instance=None, **kwargs): | ||
if instance is not None and instance.pk is None: | ||
logger.info( | ||
f'Creating TimecardPrefillData for {instance}.' | ||
) | ||
|
||
|
||
def setup_signals(): | ||
from .models import ( | ||
HolidayPrefills, ReportingPeriod, Targets, Timecard, TimecardNote, | ||
TimecardObject, TimecardPrefillData | ||
) | ||
|
||
pre_save.connect( | ||
holiday_prefills_creation, | ||
sender=HolidayPrefills, | ||
dispatch_uid="hours_holiday_prefills_creation" | ||
) | ||
pre_save.connect( | ||
reporting_period_creation, | ||
sender=ReportingPeriod, | ||
dispatch_uid="hours_reporting_period_creation" | ||
) | ||
pre_save.connect( | ||
targets_creation, | ||
sender=Targets, | ||
dispatch_uid="hours_targets_creation" | ||
) | ||
pre_save.connect( | ||
timecard_creation, | ||
sender=Timecard, | ||
dispatch_uid="hours_timecard_creation" | ||
) | ||
pre_save.connect( | ||
timecard_note_creation, | ||
sender=TimecardNote, | ||
dispatch_uid="hours_timecard_note_creation" | ||
) | ||
pre_save.connect( | ||
timecard_object_creation, | ||
sender=TimecardObject, | ||
dispatch_uid="hours_timecard_object_creation" | ||
) | ||
pre_save.connect( | ||
timecard_prefill_data_creation, | ||
sender=TimecardPrefillData, | ||
dispatch_uid="hours_timecard_prefill_data_creation" | ||
) |
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,8 @@ | ||
from django.apps import AppConfig | ||
from .signals import setup_signals | ||
|
||
class OrganizationsAppConfig(AppConfig): | ||
name = "organizations" | ||
|
||
def ready(self): | ||
setup_signals() |
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,22 @@ | ||
import logging | ||
|
||
from django.db.models.signals import pre_save | ||
|
||
logger = logging.getLogger('tock-organizations') | ||
|
||
|
||
def organization_creation(sender, instance=None, **kwargs): | ||
if instance is not None and instance.pk is None: | ||
logger.info( | ||
f'Creating Organization for {instance}.' | ||
) | ||
|
||
|
||
def setup_signals(): | ||
from .models import Organization | ||
|
||
pre_save.connect( | ||
organization_creation, | ||
sender=Organization, | ||
dispatch_uid="organizations_organization_creation" | ||
) |
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,8 @@ | ||
from django.apps import AppConfig | ||
from .signals import setup_signals | ||
|
||
class ProjectsAppConfig(AppConfig): | ||
name = "projects" | ||
|
||
def ready(self): | ||
setup_signals() |
Oops, something went wrong.