fix bazdid month in env

This commit is contained in:
javad committed 2026-06-22 15:12:19 +03:30
1 parent 65bb0f48d4
commit 96dd277f6b
4 files changed
+16 -6

No files matched your search

+6 -1
View File
@@ -1,10 +1,14 @@
from django.db.models import Count, Sum from django.db.models import Count, Sum
from django.db.models import Q from django.db.models import Q
import os
from .models import * from .models import *
def dashBoxData(request): def dashBoxData(request):
bazdid = os.environ.get('bazdid', 9)
debit = Article.objects.filter().aggregate(Sum('debit'))['debit__sum'] debit = Article.objects.filter().aggregate(Sum('debit'))['debit__sum']
credit = Article.objects.filter().aggregate(Sum('credit'))['credit__sum'] credit = Article.objects.filter().aggregate(Sum('credit'))['credit__sum']
try: try:
@@ -26,6 +30,7 @@ def dashBoxData(request):
'ActionCount': ActionCount, 'ActionCount': ActionCount,
'allUsers': allUsers, 'allUsers': allUsers,
'rezayatCount': rezayatCount, 'rezayatCount': rezayatCount,
'entezarbazdid': entezarbazdid 'entezarbazdid': entezarbazdid,
'bazdid': bazdid
} }
return data return data
+1 -1
View File
@@ -167,7 +167,7 @@
<a {% if perms.admin_panel.ViewStore %}href="{% url 'admin_panel:entezar' %}"{% endif %}> <a {% if perms.admin_panel.ViewStore %}href="{% url 'admin_panel:entezar' %}"{% endif %}>
<div class="boxIndex01 {% if url_name == 'entezar' %}has-background-danger{% else %}has-background-info{% endif %} has-text-white"> <div class="boxIndex01 {% if url_name == 'entezar' %}has-background-danger{% else %}has-background-info{% endif %} has-text-white">
<p class="ss02 ">{{ entezarbazdid }}</p> <p class="ss02 ">{{ entezarbazdid }}</p>
<p class="ss02 ">9 ماه از آخرین بازدید گذشته</p> <p class="ss02 ">{{ bazdid }} ماه از آخرین بازدید گذشته</p>
</div> </div>
</a> </a>
{% endwith %} {% endwith %}
@@ -10,7 +10,7 @@
<th>نام محصول</th> <th>نام محصول</th>
<th>ورود</th> <th>ورود</th>
<th>خروج</th> <th>خروج</th>
<th>مانده در لحظه</th> <th>توضیحات</th> <th>مانده</th> <th>توضیحات</th>
<th>تاریخ</th> <th>تاریخ</th>
</tr> </tr>
</thead> </thead>
@@ -19,7 +19,7 @@
<th>نام محصول</th> <th>نام محصول</th>
<th>ورود</th> <th>ورود</th>
<th>خروج</th> <th>خروج</th>
<th>مانده در لحظه</th> <th>توضیحات</th> <th>مانده</th> <th>توضیحات</th>
<th>تاریخ</th> <th>تاریخ</th>
</tr> </tr>
</tfoot> </tfoot>
+7 -2
View File
@@ -13,7 +13,7 @@ from django.db.models import Count, Sum
from django.contrib.auth.models import Permission, User from django.contrib.auth.models import Permission, User
from django.contrib.auth import authenticate, login, logout from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required, permission_required from django.contrib.auth.decorators import login_required, permission_required
import os
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
from django.db.models import Q from django.db.models import Q
@@ -519,7 +519,12 @@ def entezar(request):
full_path = request.get_full_path() full_path = request.get_full_path()
from django.db.models import Q from django.db.models import Q
dateTime6MonthAgo = a - datetime.timedelta(weeks=36)
bazdid = os.environ.get('bazdid', 9)
bazdid = int ( int(bazdid) * 4.3 )
dateTime6MonthAgo = a - datetime.timedelta(weeks=bazdid)
''' customers = Customer.objects.filter(name_family__isnull=False) ''' customers = Customer.objects.filter(name_family__isnull=False)
m6mbazdid = [] m6mbazdid = []
for customerObj in customers: for customerObj in customers: