cluster311 / ggg

Sistema de gestion de historias clinicas
BSD 3-Clause "New" or "Revised" License
6 stars 3 forks source link

Error al agregar turno #50

Closed avdata99 closed 5 years ago

avdata99 commented 5 years ago

Error 500 al agregar turnos

image

{'csrfmiddlewaretoken': 'jboxsqIFfg2c1XaOxhvdiE3t8gZKK1cMaWwJLmyIfHNorHesU2tVVQeNagJ3pEGX', 'inicio': '10/22/2019 10:10 PM', 'fin': '10/28/2019 10:11 PM', 'bulk': False, 'servicio': '1', 'profesional': '3099', 'duration': '10', 'estado': '0', 'paciente': '', 'id': '', 'delete': ''}
ERROR Internal Server Error: /turnos/appointments/
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 44, in add_appointment
    elif form.is_valid():
  File "/home/hudson/envs/ggg/lib/python3.6/site-packages/django/forms/forms.py", line 185, in is_valid
    return self.is_bound and not self.errors
  File "/home/hudson/envs/ggg/lib/python3.6/site-packages/django/forms/forms.py", line 180, in errors
    self.full_clean()
  File "/home/hudson/envs/ggg/lib/python3.6/site-packages/django/forms/forms.py", line 382, in full_clean
    self._clean_form()
  File "/home/hudson/envs/ggg/lib/python3.6/site-packages/django/forms/forms.py", line 409, in _clean_form
    cleaned_data = self.clean()
  File "/home/hudson/dev/cluster311/ggg/calendario/forms.py", line 36, in clean
    cleaned_data[field].replace(tzinfo=None)
KeyError: 'inicio'
ERROR "POST /turnos/appointments/ HTTP/1.1" 500 99036
avdata99 commented 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]