22 lines
		
	
	
		
			776 B
		
	
	
	
		
			Python
		
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			776 B
		
	
	
	
		
			Python
		
	
	
	
| 
 | |
| from apps.utils.viewsets import CustomModelViewSet, CustomGenericViewSet
 | |
| from apps.utils.mixins import CustomListModelMixin
 | |
| 
 | |
| from apps.wpmw.models import Wpr, WprDefect
 | |
| from apps.wpmw.serializers import WprSerializer
 | |
| 
 | |
| 
 | |
| class WprViewSet(CustomListModelMixin, CustomGenericViewSet):
 | |
|     """动态产品
 | |
| 
 | |
|     动态产品
 | |
|     """
 | |
|     perms_map = {"get": "*"}
 | |
|     select_related_fields = ["wm", "mb", "material"]
 | |
|     prefetch_related_fields = ["defects"]
 | |
|     queryset = Wpr.objects.all()
 | |
|     serializer_class = WprSerializer
 | |
|     filter_fields = ["mb", "wm", "state", "material", "defects"]
 | |
|     ordering = ["-create_time"]
 | |
|     ordering_fields = ["number", "create_time", "update_time"]
 | |
|     search_fields = ["number", "material__name", "material__model", "material__specification"] |