在营业部信息系统类型里增加一行统计信息
This commit is contained in:
@@ -56,7 +56,7 @@ def branch_detail(request, branch_id):
|
||||
public_screens = branch.public_screens.all()
|
||||
|
||||
# 获取预算数据
|
||||
budgets = Budget.objects.filter(branch=branch).select_related('activity').prefetch_related('equipment_budgets', 'infrastructure_budgets').order_by('-created_at')
|
||||
budgets = Budget.objects.filter(branch=branch).prefetch_related('equipment_budgets', 'infrastructure_budgets').order_by('-created_at')
|
||||
|
||||
# 获取预算模板
|
||||
budget_templates = BudgetTemplate.objects.all()
|
||||
@@ -228,8 +228,17 @@ def BranchAll(request):
|
||||
|
||||
# 生成branchinfo的视图
|
||||
def Branchinfo(request):
|
||||
branches = Branch.objects.all
|
||||
context = {'branches': branches, }
|
||||
branches = Branch.objects.all()
|
||||
# 统计A型、B型、C型分支机构的数量
|
||||
type_a_count = branches.filter(category='A型').count()
|
||||
type_b_count = branches.filter(category='B型').count()
|
||||
type_c_count = branches.filter(category='C型').count()
|
||||
context = {
|
||||
'branches': branches,
|
||||
'type_a_count': type_a_count,
|
||||
'type_b_count': type_b_count,
|
||||
'type_c_count': type_c_count,
|
||||
}
|
||||
return render(request, 'branch_info.html', context)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user