[bf47591] | 1 | from django.shortcuts import render |
---|
[ae65f8e] | 2 | from django.http import JsonResponse |
---|
| 3 | from django.views.generic import TemplateView |
---|
| 4 | from .models import ParticipanteEvento |
---|
[bf47591] | 5 | |
---|
[ae65f8e] | 6 | class ParticipanteEventoSearch(TemplateView): |
---|
| 7 | """! |
---|
| 8 | Muestra si un participante esta registrado en un evento |
---|
| 9 | |
---|
| 10 | @author Rodrigo Boet (rboet at cenditel.gob.ve) |
---|
[5dea5ff] | 11 | @copyright <a href='https://www.gnu.org/licenses/gpl-3.0.en.html'>GNU Public License versión 3 (GPLv3)</a> |
---|
[ae65f8e] | 12 | @date 20-11-2017 |
---|
| 13 | @version 1.0.0 |
---|
| 14 | """ |
---|
| 15 | template_name = "inicio.html" |
---|
| 16 | |
---|
| 17 | def get(self,request,pk,pasaporte): |
---|
| 18 | """! |
---|
| 19 | Metodo para antender la vista por GET |
---|
| 20 | |
---|
| 21 | @author Rodrigo Boet (rboet at cenditel.gob.ve) |
---|
| 22 | @copyright GNU/GPLv3 |
---|
| 23 | @date 20-11-2017 |
---|
| 24 | @param self <b>{object}</b> Objeto que instancia la clase |
---|
| 25 | @param request <b>{object}</b> Objeto que contiene la petición |
---|
| 26 | @param pk <b>{int}</b> Recibe el id del evento |
---|
| 27 | @param pasaporte <b>{str}</b> Recibe el número de pasaporte |
---|
| 28 | @return Retorna un Json con la respuesta |
---|
| 29 | """ |
---|
| 30 | participante = ParticipanteEvento.objects.filter(fk_evento=pk,fk_participante__pasaporte=pasaporte) |
---|
| 31 | data = {} |
---|
| 32 | if(participante): |
---|
| 33 | p = participante.get() |
---|
| 34 | data = {'firmo':p.firma,'datos':{'nombres':p.fk_participante.nombres,'apellidos':p.fk_participante.apellidos, |
---|
| 35 | 'pasaporte':pasaporte,'correo':p.fk_participante.correo}} |
---|
| 36 | return JsonResponse(data,safe=False) |
---|