from rest_framework import serializers
from . import models


class CarVINSerializer(serializers.ModelSerializer):
    class Meta:
        model = models.CarVIN
        fields = ['vin']

    def create(self, validated_data):
        vin = validated_data.pop('vin')
        return models.CarVIN.objects.create(vin=vin, **validated_data)


