1234567891011121314151617181920212223242526272829303132333435363738394041 |
- from .models import Facultad, Curso, Matricula
- from rest_framework import serializers
-
-
- class FacultadSerializer(serializers.ModelSerializer):
- class Meta:
- model = Facultad
- fields = ('__all__')
-
- def create(self, validated_data):
- instance, created = Facultad.objects.get_or_create(**validated_data)
- # print(instance, created)
- if(created == False):
- print('ya se creo')
- return validated_data
-
-
- class CursoSerializer(serializers.ModelSerializer):
- class Meta:
- model = Curso
- fields = ('__all__')
-
- def create(self, validated_data):
- instance, created = Curso.objects.get_or_create(**validated_data)
- # print(instance, created)
- if(created == False):
- print('ya se creo')
- return validated_data
-
-
- class MatriculaSerializer(serializers.ModelSerializer):
- class Meta:
- model = Curso
- fields = ('__all__')
-
- def create(self, validated_data):
- instance, created = Matricula.objects.get_or_create(**validated_data)
- # print(instance, created)
- if(created == False):
- print('ya se creo')
- return validated_data
|