python serializer.py

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python serializer.py相关的知识,希望对你有一定的参考价值。

from rest_framework import serializers
from employee.models import EmployeeResume, PROVINCE_CHOICES, EmployeeEducation, EmployeeWorkExperience
from account.models import UserProfile


class EmployeeEducationSerializer(serializers.ModelSerializer):

    class Meta:
        model = EmployeeEducation
        fields = ('id',
                  'resume',
                  'student',
                  'complete_degree',
                  'institute',
                  'institute_start_time',
                  'institute_end_time',
                  'field_of_study',
                  'details'
        )


class EmployeeWorkExperienceSerializer(serializers.ModelSerializer):
    # resume = EmployeeResumeSerializer()

    class Meta:
        model = EmployeeWorkExperience
        fields = ('id',
                  'resume',
                  'company',
                  'job_title',
                  'job_start_date',
                  'job_end_date',
                  'description'
        )


class EmployeeResumeSerializer(serializers.ModelSerializer):
    # employee = UserProfileSerializer(required =False)
    province = serializers.ChoiceField(choices=PROVINCE_CHOICES, default='Select Province')
    # student = serializers.ChoiceField(choices=STUDENT_CHOICES, default='Select Student')
    employee_education = EmployeeEducationSerializer(many=True, required=False)
    employee_work_experience = EmployeeWorkExperienceSerializer(many=True, required=False)

    class Meta:
        model = EmployeeResume

        fields = ("id",
                  'employee',
                  'first_name',
                  'last_name',
                  'address1',
                  'address2',
                  'city',
                  'province',
                  'phone_number',
                  'profile_picture',
                  'email',
                  'lat',
                  'lon',
                  'skill',
                  'language',
                  'date_of_birth',
                  'interest',
                  'extra_curricular_activities',
                  'skills',
                  'volunteer_experience',
                  'hobbies',
                  'name',
                  'active',
                  'created_on',
                  'modified_on',
                  'created_by',
                  'modified_by',
                  'employee_education',
                  'employee_work_experience'

)

以上是关于python serializer.py的主要内容,如果未能解决你的问题,请参考以下文章

如何将django组字段添加到客户用户注册表

代写python,代写python编程,python代写,python编程代写,留学生python代写

001--python全栈--基础知识--python安装

Python代写,Python作业代写,代写Python,代做Python

Python开发

Python,python,python