52 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Python
		
	
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Python
		
	
	
	
from rest_framework import serializers
 | 
						|
from .models import *
 | 
						|
from apps.system.serializers import OrganizationSerializer
 | 
						|
 | 
						|
 | 
						|
class CMASerializer(serializers.ModelSerializer):
 | 
						|
    """
 | 
						|
    CMA能力表序列化
 | 
						|
    """
 | 
						|
    class Meta:
 | 
						|
        model = CMA
 | 
						|
        fields = '__all__'
 | 
						|
 | 
						|
class CNASSerializer(serializers.ModelSerializer):
 | 
						|
    """
 | 
						|
    CNAS能力表序列化
 | 
						|
    """
 | 
						|
    class Meta:
 | 
						|
        model = CNAS
 | 
						|
        fields = '__all__'
 | 
						|
class InspectionSerializer(serializers.ModelSerializer):
 | 
						|
    """
 | 
						|
    检验能力反馈啊
 | 
						|
    """
 | 
						|
    class Meta:
 | 
						|
        model = Inspection
 | 
						|
        fields = '__all__'
 | 
						|
 | 
						|
class QualificationSerializer(serializers.ModelSerializer):
 | 
						|
    """
 | 
						|
    资质能力序列化
 | 
						|
    """
 | 
						|
    bm_=OrganizationSerializer(source = 'ssbm', read_only=True)
 | 
						|
    class Meta:
 | 
						|
        model = Qualification
 | 
						|
        fields = '__all__'
 | 
						|
    @staticmethod
 | 
						|
    def setup_eager_loading(queryset):
 | 
						|
        """ Perform necessary eager loading of data. """
 | 
						|
        queryset = queryset.select_related('ssbm')
 | 
						|
        return queryset
 | 
						|
class QualificationotherSerializer(serializers.ModelSerializer):
 | 
						|
    qualification_ = QualificationSerializer(source = 'qualification', read_only=True)
 | 
						|
    
 | 
						|
    class Meta:
 | 
						|
        model = Qualificationother
 | 
						|
        fields = '__all__'
 | 
						|
    @staticmethod
 | 
						|
    def setup_eager_loading(queryset):
 | 
						|
        """ Perform necessary eager loading of data. """
 | 
						|
        queryset = queryset.select_related('qualification')
 | 
						|
        return queryset |