-
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.
Fix: #42 Implementation for configuring DW instance for dataspace
- Loading branch information
1 parent
3738d43
commit b5b7c92
Showing
5 changed files
with
173 additions
and
50 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,21 @@ | ||
from django.db.models.signals import pre_save, post_save | ||
from django.dispatch import receiver | ||
from data_disclosure_agreement.models import DataDisclosureAgreement | ||
|
||
|
||
def query_ddas_and_update_is_latest_flag_to_false_for_previous_versions( | ||
sender, instance, **kwargs | ||
): | ||
if instance.isLatestVersion: | ||
ddas = DataDisclosureAgreement.objects.filter( | ||
templateId=instance.templateId, isLatestVersion=True | ||
).exclude(pk=instance.id) | ||
for dda in ddas: | ||
dda.isLatestVersion = False | ||
dda.save() | ||
|
||
|
||
post_save.connect( | ||
query_ddas_and_update_is_latest_flag_to_false_for_previous_versions, | ||
DataDisclosureAgreement, | ||
) |
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