Antes de actualizar despues actualizar index Timbres y Clientes Q queryset
This commit is contained in:
@@ -15,7 +15,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
|||||||
SECRET_KEY = os.getenv("adminAS_KEY")
|
SECRET_KEY = os.getenv("adminAS_KEY")
|
||||||
|
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = False
|
DEBUG = True
|
||||||
|
|
||||||
ALLOWED_HOSTS = ['*']
|
ALLOWED_HOSTS = ['*']
|
||||||
# Application definition
|
# Application definition
|
||||||
|
|||||||
18
Clientes/migrations/0015_alter_timbres_rfcc.py
Normal file
18
Clientes/migrations/0015_alter_timbres_rfcc.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 4.1.3 on 2023-02-24 21:31
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('Clientes', '0014_alter_clientes_options'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='timbres',
|
||||||
|
name='rfcc',
|
||||||
|
field=models.CharField(db_index=True, max_length=13),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -1,14 +1,16 @@
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
|
||||||
|
|
||||||
class saldoModel(models.Model):
|
class saldoModel(models.Model):
|
||||||
saldo = models.IntegerField()
|
saldo = models.IntegerField()
|
||||||
|
|
||||||
|
|
||||||
class Timbres(models.Model):
|
class Timbres(models.Model):
|
||||||
uuid = models.CharField(max_length=36, unique=True)
|
uuid = models.CharField(max_length=36, unique=True)
|
||||||
rfcc = models.CharField(max_length=13)
|
rfcc = models.CharField(max_length=13,db_index=True)
|
||||||
rfcp = models.CharField(max_length=13)
|
rfcp = models.CharField(max_length=13)
|
||||||
fecha = models.CharField(max_length=55)
|
fecha = models.CharField(max_length=55)
|
||||||
folio = models.CharField(max_length=55)
|
folio = models.CharField(max_length=55)
|
||||||
@@ -57,10 +59,15 @@ class Clientes(models.Model):
|
|||||||
else:#28 or 29
|
else:#28 or 29
|
||||||
findate = dat + datetime.timedelta(days=28)
|
findate = dat + datetime.timedelta(days=28)
|
||||||
findate += datetime.timedelta(days=1)
|
findate += datetime.timedelta(days=1)
|
||||||
|
|
||||||
|
filter_q = Q(rfcc=self.RFC) & Q(created_at__range=[dat,findate])
|
||||||
if PAC:
|
if PAC:
|
||||||
cou = Timbres.objects.filter(rfcc=self.RFC, created_at__range=[dat,findate], rfcp=PAC).count()
|
filter_q &=Q(rfcp=PAC)
|
||||||
else:
|
cou = Timbres.objects.filter(filter_q).count()
|
||||||
cou = Timbres.objects.filter(rfcc=self.RFC, created_at__range=[dat,findate]).count()
|
# if PAC:
|
||||||
|
# cou = Timbres.objects.filter(rfcc=self.RFC, created_at__range=[dat,findate], rfcp=PAC).count()
|
||||||
|
# else:
|
||||||
|
# cou = Timbres.objects.filter(rfcc=self.RFC, created_at__range=[dat,findate]).count()
|
||||||
self.conteo_mes =cou
|
self.conteo_mes =cou
|
||||||
self.save()
|
self.save()
|
||||||
|
|
||||||
|
|||||||
@@ -447,9 +447,9 @@ class saldo_funct2(APIView):
|
|||||||
return Response(content)
|
return Response(content)
|
||||||
|
|
||||||
class check_host(APIView):
|
class check_host(APIView):
|
||||||
permission_classes = (IsAuthenticated,ItsAdminToken,)
|
permission_classes = (IsAuthenticated,ItsAdminToken,)
|
||||||
def post(self,request, format=None):
|
def post(self,request, format=None):
|
||||||
data = request.data
|
data = request.data
|
||||||
return Response(data)
|
return Response(data)
|
||||||
#---------------------------CLASS BASED VIEWS
|
#---------------------------CLASS BASED VIEWS
|
||||||
#--------------------------------------------
|
#--------------------------------------------
|
||||||
|
|||||||
17
Sistemas/migrations/0013_alter_bitacoraerrores_options.py
Normal file
17
Sistemas/migrations/0013_alter_bitacoraerrores_options.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# Generated by Django 4.1.3 on 2023-02-24 21:31
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('Sistemas', '0012_bitacoraerrores_view'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='bitacoraerrores',
|
||||||
|
options={'ordering': ('-timestamp',)},
|
||||||
|
),
|
||||||
|
]
|
||||||
Reference in New Issue
Block a user