Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1from marshmallow import fields 

2 

3from src import ma 

4from src.model import GenreModel 

5from src.utils import SQLAlchemyAutoSchema 

6 

7 

8class GenreMeta: 

9 model = GenreModel 

10 

11 

12class GenreBase(SQLAlchemyAutoSchema): 

13 class Meta(GenreMeta): 

14 fields = ("genre_id", "name", "count") 

15 

16 

17class GenreObject(SQLAlchemyAutoSchema): 

18 linked_genres = ma.Nested("GenreBase", many=True) 

19 content_type = fields.Method("get_content_type") 

20 

21 def get_content_type(self, obj): 

22 return obj.content_type.value 

23 

24 class Meta(GenreMeta): 

25 pass