Antes de actualizar despues actualizar index Timbres y Clientes Q queryset

This commit is contained in:
fjrodriguez
2023-02-24 15:33:07 -06:00
parent 4983cdc8fa
commit c84ef13d33
5 changed files with 49 additions and 7 deletions

View File

@@ -15,7 +15,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = os.getenv("adminAS_KEY")
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
DEBUG = True
ALLOWED_HOSTS = ['*']
# Application definition

View 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),
),
]

View File

@@ -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()

View File

@@ -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
#--------------------------------------------

View 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',)},
),
]