Cambios de / [d45fcdc:38840b5] en gestor_consulta
- Ficheros:
-
- 5 editados
Leyenda
- No modificado
- Añadido
- Eliminado
-
consulta/rest.py
rabd93af rfecfc90 16 16 from .models import Consulta, Pregunta 17 17 from rest_framework import viewsets 18 from rest_framework.permissions import IsAuthenticated 18 19 19 20 … … 29 30 serializer_class = ConsultaSerializer 30 31 http_method_names = ['get','head'] 32 permission_classes = (IsAuthenticated,) 31 33 32 34 def get_queryset(self): -
gestor_consulta/settings.py
rd45fcdc rd45fcdc 158 158 EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' 159 159 160 ## Configuraciones del rest framework 160 161 REST_FRAMEWORK = { 161 'DEFAULT_FILTER_BACKENDS': ('django_filters.rest_framework.DjangoFilterBackend',), 162 # taken from http://getblimp.github.io/django-rest-framework-jwt/ to test JWT 162 'DEFAULT_FILTER_BACKENDS': ( 163 'django_filters.rest_framework.DjangoFilterBackend', 164 ), 165 'DEFAULT_PERMISSION_CLASSES': ( 166 'rest_framework.permissions.IsAuthenticated', 167 ), 163 168 'DEFAULT_AUTHENTICATION_CLASSES': ( 169 'rest_framework.authentication.SessionAuthentication', 164 170 'rest_framework_jwt.authentication.JSONWebTokenAuthentication', 165 'rest_framework.authentication.SessionAuthentication', 166 'rest_framework.authentication.BasicAuthentication', 171 167 172 ), 168 173 } -
gestor_consulta/urls.py
re81243a re81243a 29 29 url(r'^api/', include(router.urls)), 30 30 url(r'^api-token-auth/', obtain_jwt_token), 31 url(r'^api-token-refresh/', refresh_jwt_token), 31 32 ] -
static/js/funciones.js
re4911cf r9b33f35 175 175 text:"Guardar", 176 176 callback:function(){ 177 submitOption( this);177 submitOption($('.material-dialog #formulario_modal').last()); 178 178 } 179 179 } … … 190 190 **/ 191 191 function submitOption(objecto) { 192 var input = $(objecto). parent().parent().find('#opciones #id_texto_opcion');192 var input = $(objecto).find('#opciones #id_texto_opcion'); 193 193 var vacio = false; 194 194 $.each(input,function(key,value){ … … 198 198 }); 199 199 if (!vacio) { 200 var form = $(objecto).parent().parent().find('form');201 200 $.ajax({ 202 data: $( form).serialize(),201 data: $(objecto).serialize(), 203 202 type: 'POST', 204 url: URL_CREAR_OPCIONES+$( form).attr('action'),203 url: URL_CREAR_OPCIONES+$(objecto).attr('action'), 205 204 success: function(response) { 206 205 if (response.code) { … … 284 283 **/ 285 284 function update_option(id) { 286 var form = $( "#option_form");285 var form = $('.material-dialog').last().find("#option_form"); 287 286 $.ajax({ 288 287 data: $(form).serialize(), … … 308 307 * @param id Recibe el id de la pregunta 309 308 **/ 310 function del_option( id) {309 function del_option(objeto,id) { 311 310 MaterialDialog.dialog( 312 311 "¿Desea borrar la opción seleccionada?", … … 322 321 text:"Si", 323 322 callback:function(){ 324 delete_option( id);323 delete_option(objeto,id); 325 324 } 326 325 } … … 482 481 * @param id Recibe el id de la opcion 483 482 **/ 484 function delete_option( id) {483 function delete_option(objeto,id) { 485 484 var token = $('input').val(); 486 485 var input = ''; 487 $.each($( '#option_form').find('input'),function(index,value){486 $.each($(objeto).find('#option_form input'),function(index,value){ 488 487 if ($(value).attr('name') == 'texto_opcion_id' && $(value).val() == id) { 489 488 input = value; … … 496 495 success: function(response) { 497 496 if (response.success) { 498 $( input).parent().parent().parent().parent().remove();497 $(objeto).parent().parent().remove(); 499 498 Materialize.toast("Se eliminó la opción con éxito", 4000); 500 499 }
Nota: Vea TracChangeset
para ayuda en el uso del visor de conjuntos de cambios.