1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Standardized graph display; added templatization for graph links

This commit is contained in:
Jeremy Stretch
2016-06-24 11:16:49 -04:00
parent 9de8ac91a1
commit 39330850b3
6 changed files with 42 additions and 57 deletions

View File

@@ -5,10 +5,14 @@ from extras.models import Graph
class GraphSerializer(serializers.ModelSerializer):
embed_url = serializers.SerializerMethodField()
embed_link = serializers.SerializerMethodField()
class Meta:
model = Graph
fields = ['name', 'embed_url', 'link']
fields = ['name', 'embed_url', 'embed_link']
def get_embed_url(self, obj):
return obj.embed_url(self.context['graphed_object'])
def get_embed_link(self, obj):
return obj.embed_link(self.context['graphed_object'])