-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove target input from form if its fixed, add ability to share targ…
…et and its existing data when creating a persistent share, remove download from the destinations list, and bold the service portion of destination string
- Loading branch information
Jon
committed
Dec 19, 2024
1 parent
820fa5d
commit a62799a
Showing
13 changed files
with
117 additions
and
54 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
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 rest_framework import serializers | ||
from tom_dataproducts.sharing import get_sharing_destination_options | ||
from tom_targets.sharing import share_target_and_all_data | ||
from tom_targets.fields import TargetFilteredPrimaryKeyRelatedField | ||
from tom_targets.models import PersistentShare, Target | ||
|
||
|
||
class PersistentShareSerializer(serializers.ModelSerializer): | ||
destination = serializers.ChoiceField(choices=get_sharing_destination_options(include_download=False), required=True) | ||
target = TargetFilteredPrimaryKeyRelatedField(queryset=Target.objects.all(), required=True) | ||
share_existing_data = serializers.BooleanField(default=False, required=False, write_only=True) | ||
|
||
class Meta: | ||
model = PersistentShare | ||
fields = ('id', 'target', 'destination', 'user', 'created', 'share_existing_data') | ||
|
||
def create(self, validated_data): | ||
shared_existing_data = validated_data.pop('share_existing_data', None) | ||
if shared_existing_data: | ||
share_target_and_all_data(validated_data['destination'], validated_data['target']) | ||
return super().create(validated_data) |
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
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