Antes de actualizar despues actualizar index Timbres y Clientes Q queryset
This commit is contained in:
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
|
||||
import datetime
|
||||
|
||||
from django.db.models import Q
|
||||
|
||||
|
||||
class saldoModel(models.Model):
|
||||
saldo = models.IntegerField()
|
||||
|
||||
|
||||
class Timbres(models.Model):
|
||||
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)
|
||||
fecha = models.CharField(max_length=55)
|
||||
folio = models.CharField(max_length=55)
|
||||
@@ -57,10 +59,15 @@ class Clientes(models.Model):
|
||||
else:#28 or 29
|
||||
findate = dat + datetime.timedelta(days=28)
|
||||
findate += datetime.timedelta(days=1)
|
||||
|
||||
filter_q = Q(rfcc=self.RFC) & Q(created_at__range=[dat,findate])
|
||||
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()
|
||||
filter_q &=Q(rfcp=PAC)
|
||||
cou = Timbres.objects.filter(filter_q).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.save()
|
||||
|
||||
|
||||
@@ -447,9 +447,9 @@ class saldo_funct2(APIView):
|
||||
return Response(content)
|
||||
|
||||
class check_host(APIView):
|
||||
permission_classes = (IsAuthenticated,ItsAdminToken,)
|
||||
permission_classes = (IsAuthenticated,ItsAdminToken,)
|
||||
def post(self,request, format=None):
|
||||
data = request.data
|
||||
data = request.data
|
||||
return Response(data)
|
||||
#---------------------------CLASS BASED VIEWS
|
||||
#--------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user