from rest_framework import serializers
from .models import Relation, Variant


class VariantSerializer(serializers.HyperlinkedModelSerializer):
    """
    Serialize a Variant object.
    """

    b37_id = serializers.SerializerMethodField()

    class Meta:
        model = Variant
        fields = ['b37_id', 'tags']

    @staticmethod
    def get_b37_id(obj):
        """
        Return an ID like "1-883516-G-A".
        """
        return '-'.join([
            obj.tags['chrom_b37'],
            obj.tags['pos_b37'],
            obj.tags['ref_allele_b37'],
            obj.tags['var_allele_b37'],
        ])


class RelationSerializer(serializers.HyperlinkedModelSerializer):
    """
    Serialize a Relation object.
    """

    class Meta:
        model = Relation
        fields = ['tags']

from rest_framework import serializers
from .models import Relation, Variant


class VariantSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Variant
        fields = ["tags"]


class RelationSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Relation
        fields = ["tags"]

--- 
+++ 
@@ -3,12 +3,34 @@
 
 
 class VariantSerializer(serializers.HyperlinkedModelSerializer):
+    """
+    Serialize a Variant object.
+    """
+
+    b37_id = serializers.SerializerMethodField()
+
     class Meta:
         model = Variant
-        fields = ["tags"]
+        fields = ['b37_id', 'tags']
+
+    @staticmethod
+    def get_b37_id(obj):
+        """
+        Return an ID like "1-883516-G-A".
+        """
+        return '-'.join([
+            obj.tags['chrom_b37'],
+            obj.tags['pos_b37'],
+            obj.tags['ref_allele_b37'],
+            obj.tags['var_allele_b37'],
+        ])
 
 
 class RelationSerializer(serializers.HyperlinkedModelSerializer):
+    """
+    Serialize a Relation object.
+    """
+
     class Meta:
         model = Relation
-        fields = ["tags"]
+        fields = ['tags']
Return the variant ID in the API
