Conjunto fecfc90 en gestor_consulta
- Fecha y hora:
- 24/08/2017 15:27:39 (hace 7 años)
- Branches:
- master
- Children:
- 9b33f35
- Parents:
- abd93af
- 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
r2353277 rfecfc90 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 'DEFAULT_FILTER_BACKENDS': ( 163 'django_filters.rest_framework.DjangoFilterBackend', 164 ), 165 'DEFAULT_PERMISSION_CLASSES': ( 166 'rest_framework.permissions.IsAuthenticated', 167 ), 168 'DEFAULT_AUTHENTICATION_CLASSES': ( 169 'rest_framework.authentication.SessionAuthentication', 170 'rest_framework_jwt.authentication.JSONWebTokenAuthentication', 171 ), 162 172 } -
gestor_consulta/urls.py
rd7b19bc rfecfc90 17 17 from django.contrib import admin 18 18 from rest.routers import router 19 from rest_framework_jwt.views import obtain_jwt_token 20 from rest_framework_jwt.views import refresh_jwt_token 19 21 20 22 urlpatterns = [ … … 25 27 url(r'^captcha/', include('captcha.urls')), 26 28 url(r'^api/', include('rest_framework.urls', namespace='rest_framework')), 27 url(r'^api/', include(router.urls)) 29 url(r'^api/', include(router.urls)), 30 url(r'^api-token-auth/', obtain_jwt_token), 31 url(r'^api-token-refresh/', refresh_jwt_token), 28 32 ] -
static/js/funciones.js
re4911cf rfecfc90 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) { … … 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.