Exemplo n.º 1
0
class GeneSerializer(serializers.ModelSerializer):
    chromosome = ChromosomeSerializer.PrimaryKeyRelatedField(many=False,
                                                             read_only=True)

    class Meta:
        model = Gene
        fields = ['chromosome', 'name', 'id']
Exemplo n.º 2
0
class GeneSerializer(serializers.ModelSerializer):
    chromosome = ChromosomeSerializer(many=False, read_only=True)

    class Meta:
        model = Gene
        fields = ['chromosome', 'name', 'id']

    def get_queryset(self):
        name = self.request.GET.get('name', None)
        if name == None:
            return Gene.objects.first()
        else:
            return Gene.objects.filter(name=name)
class ElementSerializer(serializers.HyperlinkedModelModelSerializer):
    chromosome = ChromosomeSerializer(many=False, read_only=True)
    track = TrackSerializer(many=False, read_only=True)
    class Meta:
        model = Element 
        fields = ['id', 'track', 'chromosome']
class GeneSerializer(serializers.HyperlinkedModelSerializer):
    chromosome = ChromosomeSerializer(many=False, read_only=True)
    class Meta:
        model = Message
        fields = ['chromosome', 'name', 'id']    
class ElementSerializer(serializers.HyperlinkedModelModelSerializer):
    chromosome = ChromosomeSerializer(many=False, read_only=True)
    track 
    class Meta:
        model = Element 
        fields = '__all__' 
Exemplo n.º 6
0
class GeneSerializer(serializers.ModelSerializer):
    chromosome = ChromosomeSerializer(many=False, read_only=True)
    class Meta:
        model = Gene
        fields = ['id'chromosome', 'name', 'id']