Merge branch 'feature/agregar_valores_relationship_evento' into 'develop'
se agrega el contendio de los objetos en el serializer Feature: -Recuperar el contendio de relationship en endpoint evento test resultado: ======================================================================================================== 3 passed in 2.49s ======================================================================================================== See merge request !4
Showing
1 changed file
with
13 additions
and
2 deletions
1 | from rest_framework_json_api import serializers | 1 | from rest_framework_json_api import serializers |
2 | 2 | ||
3 | -from .models import Evento | 3 | +from .models import Evento, FechaEvento |
4 | +from organismo.serializers import OrganismoSerializer, DependenciaSerializer | ||
5 | + | ||
6 | + | ||
7 | +class FechaEventoSerializer(serializers.ModelSerializer): | ||
8 | + class Meta: | ||
9 | + model = FechaEvento | ||
10 | + fields = serializers.ALL_FIELDS | ||
4 | 11 | ||
5 | 12 | ||
6 | class EventoSerializer(serializers.ModelSerializer): | 13 | class EventoSerializer(serializers.ModelSerializer): |
14 | + organismo = OrganismoSerializer(many=True, read_only=True) | ||
15 | + dependencia = DependenciaSerializer(many=True, read_only=True) | ||
16 | + fechas = FechaEventoSerializer(many=True, read_only=True) | ||
17 | + | ||
7 | class Meta: | 18 | class Meta: |
8 | model = Evento | 19 | model = Evento |
9 | fields = ( | 20 | fields = ( |
@@ -20,4 +31,4 @@ class EventoSerializer(serializers.ModelSerializer): | @@ -20,4 +31,4 @@ class EventoSerializer(serializers.ModelSerializer): | ||
20 | 'organismo', | 31 | 'organismo', |
21 | 'dependencia', | 32 | 'dependencia', |
22 | 'imagen', | 33 | 'imagen', |
23 | - ) | ||
34 | + ) |
-
Please register or login to post a comment