-
Notifications
You must be signed in to change notification settings - Fork 0
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 #143 from CodeHive-Solutions/dev
Solve bug with vacations
- Loading branch information
Showing
38 changed files
with
351 additions
and
401 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
23 changes: 23 additions & 0 deletions
23
INSIGHTSAPI/vacation/migrations/0023_set_user_job_position.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,23 @@ | ||
from django.db import migrations | ||
|
||
|
||
def set_user_job_position(apps, schema_editor): | ||
# Get the models involved | ||
VacationRequest = apps.get_model("vacation", "VacationRequest") | ||
User = apps.get_model("users", "User") | ||
|
||
# Iterate over all VacationRequest instances to set user_job_position | ||
for request in VacationRequest.objects.all(): | ||
if request.user and request.user.job_position: | ||
request.user_job_position = request.user.job_position | ||
request.save(update_fields=["user_job_position"]) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
operations = [ | ||
migrations.RunPython(set_user_job_position), | ||
] | ||
|
||
dependencies = [ | ||
("vacation", "0022_alter_vacationrequest_sat_is_working"), | ||
] |
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.