serializer.py 661 B

12345678910111213141516171819202122232425
  1. from rest_framework import serializers
  2. from rest_framework.serializers import ListSerializer
  3. from basic.models import Menu, RouterMenu, GroupRouterMenu
  4. class MenuSerializer(serializers.ModelSerializer):
  5. class Meta:
  6. model = Menu
  7. list_serializer = ListSerializer
  8. fields = '__all__'
  9. class RouterMenuSerializer(serializers.ModelSerializer):
  10. class Meta:
  11. model = RouterMenu
  12. list_serializer = ListSerializer
  13. fields = '__all__'
  14. class GroupRouterMenuSerializer(serializers.ModelSerializer):
  15. class Meta:
  16. model = GroupRouterMenu
  17. list_serializer = ListSerializer
  18. fields = '__all__'