# Create your views here.
import os
import time
import cx_Oracle
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from rest_framework.renderers import JSONRenderer
from rest_framework.parsers import JSONParser
from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from consola.models import Actividad,Conexion,Modulo,Transaccion,Workflow,Workflow_Transaccion,Tabla,Campo_Valor,Grupo,Campo_Cuenta,Concepto
from consola.serializers import *
class JSONResponse(HttpResponse):
    """
    An HttpResponse that renders it's content into JSON.
    """
    def __init__(self, data, **kwargs):
        content = JSONRenderer().render(data)
        kwargs['content_type'] = 'application/json'
        super(JSONResponse, self).__init__(content, **kwargs)


@csrf_exempt
def vigencia_list(request):
    da = time.time()
    mes = time.localtime(da)[1]
    mesreal = "0"
    if(mes<10):
        mesreal = "0"+str(mes)
    else:
        mesreal = (mes)
    return JSONResponse(mesreal)
