Skip to content
Snippets Groups Projects
Commit 9fde021a authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[toolchains][serializers] Pre-commit cleanup

parent 96dfc0ed
No related branches found
No related tags found
1 merge request!327Refactor update creation api
......@@ -36,7 +36,7 @@ from .models import Toolchain
import beat.core.toolchain
#----------------------------------------------------------
# ----------------------------------------------------------
class ToolchainCreationSerializer(ContributionCreationSerializer):
......@@ -45,7 +45,7 @@ class ToolchainCreationSerializer(ContributionCreationSerializer):
beat_core_class = beat.core.toolchain
#----------------------------------------------------------
# ----------------------------------------------------------
class ToolchainSerializer(ContributionSerializer):
......@@ -58,25 +58,32 @@ class ToolchainSerializer(ContributionSerializer):
model = Toolchain
def get_referencing_experiments(self, obj):
user = self.context.get('user')
user = self.context.get("user")
experiments = obj.experiments.for_user(user, True).order_by('-creation_date')
experiments = obj.experiments.for_user(user, True).order_by("-creation_date")
serializer = ExperimentSerializer(experiments, many=True)
referencing_experiments = serializer.data
# Put the pending experiments first
ordered_result = filter(lambda x: x['creation_date'] is None, referencing_experiments)
ordered_result += filter(lambda x: x['creation_date'] is not None, referencing_experiments)
ordered_result = filter(
lambda x: x["creation_date"] is None, referencing_experiments
)
ordered_result += filter(
lambda x: x["creation_date"] is not None, referencing_experiments
)
return ordered_result
def get_new_experiment_url(self, obj):
return obj.get_new_experiment_url()
#----------------------------------------------------------
# ----------------------------------------------------------
class FullToolchainSerializer(ToolchainSerializer):
class FullToolchainSerializer(ToolchainSerializer):
class Meta(ToolchainSerializer.Meta):
default_fields = ToolchainSerializer.Meta.default_fields + ToolchainSerializer.Meta.extra_fields
default_fields = (
ToolchainSerializer.Meta.default_fields
+ ToolchainSerializer.Meta.extra_fields
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment