Closed avdata99 closed 5 years ago
@franagustin Ahora lo puedo agregar pero cuando lo quiero ver me tira un
Traceback (most recent call last):
File "/home/hudson/envs/ggg/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
response = get_response(request)
File "/home/hudson/envs/ggg/lib/python3.6/site-packages/django/core/handlers/base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/home/hudson/envs/ggg/lib/python3.6/site-packages/django/core/handlers/base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/hudson/dev/cluster311/ggg/calendario/views.py", line 121, in feed
return JsonResponse(turnos, safe=False)
File "/home/hudson/envs/ggg/lib/python3.6/site-packages/django/http/response.py", line 558, in __init__
data = json.dumps(data, cls=encoder, **json_dumps_params)
File "/usr/lib/python3.6/json/__init__.py", line 238, in dumps
**kw).encode(obj)
File "/usr/lib/python3.6/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python3.6/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/home/hudson/envs/ggg/lib/python3.6/site-packages/django/core/serializers/json.py", line 104, in default
return super().default(o)
File "/usr/lib/python3.6/json/encoder.py", line 180, in default
o.__class__.__name__)
TypeError: Object of type 'Profesional' is not JSON serializable
ERROR "GET /turnos/feed?start=2019-10-28T00%3A00%3A00-03%3A00&end=2019-11-04T00%3A00%3A00-03%3A00 HTTP/1.1" 500 107810
Relacionado a
def feed(request):
turnos = get_appointments_list(**request.GET)
turnos = [{
'id': t.id,
'title': str(t),
'start': t.inicio.isoformat(),
'end': t.fin.isoformat(),
'service': t.servicio.pk,
'status': t.estado,
'professional': t.profesional,
'patient': t.paciente
} for t in turnos]
Error 500 al agregar turnos