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

19 lines
517 B
Python
Raw Normal View History

2016-03-01 11:23:03 -05:00
from rest_framework import serializers
from extras.models import Graph
class GraphSerializer(serializers.ModelSerializer):
embed_url = serializers.SerializerMethodField()
embed_link = serializers.SerializerMethodField()
2016-03-01 11:23:03 -05:00
class Meta:
model = Graph
fields = ['name', 'embed_url', 'embed_link']
2016-03-01 11:23:03 -05:00
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'])