class LevelSerializer(serializers.ModelSerializer):
episode = serializers.HyperlinkedRelatedField(view_name='episode-detail', read_only=True)
class Meta:
model = Level
fields = ('url', 'name', 'episode')
class EpisodeSerializer(serializers.ModelSerializer):
class Meta:
model = Episode
fields = ('url', 'name')
class LevelViewSet(viewsets.ModelViewSet):
queryset = Level.objects.all()
serializer_class = LevelSerializer
I would like to populate a field called title and use the following code
as the string is stored in a separate .py file.
title = getattr(messages, title)
--
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-fram...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
| Filipe Ximenes +55 (81) 8245-9204 Vinta Software Studio http://www.vinta.com.br |
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.