serializer.py 464 B

123456789101112131415161718
  1. from rest_framework import serializers
  2. from rest_framework.serializers import ListSerializer
  3. from power.models import Route, UserRoute
  4. class RouteSerializer(serializers.ModelSerializer):
  5. class Meta:
  6. model = Route
  7. list_serializer = ListSerializer
  8. fields = '__all__'
  9. class UserRouteSerializer(serializers.ModelSerializer):
  10. class Meta:
  11. model = UserRoute
  12. list_serializer = ListSerializer
  13. fields = '__all__'