Esempio n. 1
0
class ElementSerializer(serializers.HyperlinkedModelSerializer):
    chromosome = ChromosomeSerializer(many=False, read_only=True)
    track = TrackSerializer(many=False, read_only=True)

    class Meta:
        model = Element
        fields = ['id', 'track', 'chromosome']

    def create(self, validated_data):
        chromosome = validated_data.pop('chromosome', [])
        element = super().create(validated_data)
        chr_qs = chromosome.objects.filter(name__in=chromosome)
        element
Esempio n. 2
0
class ElementSerializer(serializers.HyperlinkedModelSerializer):
    chromosome = ChromosomeSerializer(many=False, read_only=True)
    track = TrackSerializer(many=False, read_only=True)
    class Meta:
        model = Element 
        fields = ['id', 'track.id', 'chromosome']