更新README文件并添加机构数量统计功能
This commit is contained in:
@@ -135,6 +135,8 @@ def BranchAll(request):
|
||||
total_branch_count = len(branches_with_counts)
|
||||
# 获取所有分支机构总数(包括没有活动的)
|
||||
all_branch_count = Branch.objects.count()
|
||||
fen_company_count = Branch.objects.filter(name__contains='分公司').count()
|
||||
yingyebu_count = Branch.objects.filter(name__contains='营业部').count()
|
||||
# 比如说end_time()的year是2024年,但是now()是2025年的2月,fileter出来,但是如果now()是2025年3月,则不显示
|
||||
now = datetime.now()
|
||||
print(f"当前月份是{now.month},年是{now.year}")
|
||||
@@ -215,6 +217,8 @@ def BranchAll(request):
|
||||
'latest_act': latest_act,
|
||||
'total_branch_count':total_branch_count,
|
||||
'all_branch_count': all_branch_count,
|
||||
'fen_company_count': fen_company_count,
|
||||
'yingyebu_count': yingyebu_count,
|
||||
'branch_count': branch_count,
|
||||
'ongoing_activities': ongoing_activities,
|
||||
'total_activities': total_activities,
|
||||
@@ -237,11 +241,19 @@ def Branchinfo(request):
|
||||
type_a_count = branches.filter(category='A型').count()
|
||||
type_b_count = branches.filter(category='B型').count()
|
||||
type_c_count = branches.filter(category='C型').count()
|
||||
all_branch_count = branches.count()
|
||||
fen_company_count = branches.filter(name__contains='分公司').exclude(name__contains='(筹)').count()
|
||||
yingyebu_count = branches.filter(name__contains='营业部').exclude(name__contains='(筹)').count()
|
||||
preparing_count = branches.filter(name__contains='(筹)').count()
|
||||
context = {
|
||||
'branches_by_province': branches_by_province,
|
||||
'type_a_count': type_a_count,
|
||||
'type_b_count': type_b_count,
|
||||
'type_c_count': type_c_count,
|
||||
'all_branch_count': all_branch_count,
|
||||
'fen_company_count': fen_company_count,
|
||||
'yingyebu_count': yingyebu_count,
|
||||
'preparing_count': preparing_count,
|
||||
}
|
||||
return render(request, 'branch_info.html', context)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user