get alias and note infos together
This commit is contained in:
parent
610a4f0b3f
commit
d8949a993a
3 changed files with 42 additions and 4 deletions
|
|
@ -92,6 +92,20 @@ class NotePolymorphicSerializer(PolymorphicSerializer):
|
|||
class Meta:
|
||||
model = Note
|
||||
|
||||
class ConsumerSerializer(serializers.ModelSerializer):
|
||||
"""
|
||||
REST API Nested Serializer for Consumers.
|
||||
return Alias, and the note Associated to it in
|
||||
"""
|
||||
note = NotePolymorphicSerializer()
|
||||
class Meta:
|
||||
model = Alias
|
||||
fields = '__all__'
|
||||
|
||||
@staticmethod
|
||||
def setup_eager_loading(queryset):
|
||||
queryset = queryset.select_related('note')
|
||||
|
||||
|
||||
class TemplateCategorySerializer(serializers.ModelSerializer):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue