Last change
on this file since e1c108e was
e1c108e,
checked in by rudmanmrrod <rudman22@…>, 7 años ago
|
Agregado servicio de consulta por token, documentado el codigo
|
-
Propiedad mode establecida a
100644
|
File size:
1.5 KB
|
Línea | |
---|
1 | # -*- coding: utf-8 -*- |
---|
2 | """ |
---|
3 | Sistema de Consulta Pública |
---|
4 | |
---|
5 | Copyleft (@) 2017 CENDITEL nodo Mérida - https://planificacion.cenditel.gob.ve/trac/wiki/ModeladoTopicos_2017 |
---|
6 | """ |
---|
7 | ## @package consulta.rest |
---|
8 | # |
---|
9 | # ViewSet (vistas de los rest) para el rest framework |
---|
10 | # @author Rodrigo Boet (rboet at cenditel.gob.ve) |
---|
11 | # @author <a href='http://www.cenditel.gob.ve'>Centro Nacional de Desarrollo e Investigación en TecnologÃas Libres |
---|
12 | # (CENDITEL) nodo Mérida - Venezuela</a> |
---|
13 | # @copyright <a href='http://www.gnu.org/licenses/gpl-2.0.html'>GNU Public License versión 2 (GPLv2)</a> |
---|
14 | # @version 1.0 |
---|
15 | from .serializers import ConsultaSerializer, PreguntaSerializer |
---|
16 | from .models import Consulta, Pregunta |
---|
17 | from rest_framework import viewsets |
---|
18 | |
---|
19 | |
---|
20 | class ConsultaViewSet(viewsets.ModelViewSet): |
---|
21 | """! |
---|
22 | Clase que gestiona los datos rest de la consulta |
---|
23 | |
---|
24 | @author Rodrigo Boet (rboet at cenditel.gob.ve) |
---|
25 | @copyright <a href='http://www.gnu.org/licenses/gpl-2.0.html'>GNU Public License versión 2 (GPLv2)</a> |
---|
26 | @date 20-06-2017 |
---|
27 | @version 1.0.0 |
---|
28 | """ |
---|
29 | serializer_class = ConsultaSerializer |
---|
30 | http_method_names = ['get','head'] |
---|
31 | |
---|
32 | def get_queryset(self): |
---|
33 | """! |
---|
34 | Metodo que permite generar la consulta al modelo |
---|
35 | |
---|
36 | @author Rodrigo Boet (rboet at cenditel.gob.ve) |
---|
37 | @copyright GNU/GPLv2 |
---|
38 | @date 22-06-2017 |
---|
39 | @param self <b>{object}</b> Objeto que instancia la clase |
---|
40 | @return Retorna los datos de contexto |
---|
41 | """ |
---|
42 | return Consulta.objects.filter(token=self.kwargs['token']).all() |
---|
Nota: Vea
TracBrowser
para ayuda de uso del navegador del repositorio.