diff --git a/fzjgact/huodong/__pycache__/views.cpython-311.pyc b/fzjgact/huodong/__pycache__/views.cpython-311.pyc index 80f06ef..87f3c1d 100644 Binary files a/fzjgact/huodong/__pycache__/views.cpython-311.pyc and b/fzjgact/huodong/__pycache__/views.cpython-311.pyc differ diff --git a/fzjgact/huodong/templates/branch_detail.html b/fzjgact/huodong/templates/branch_detail.html index a0d0007..392e738 100644 --- a/fzjgact/huodong/templates/branch_detail.html +++ b/fzjgact/huodong/templates/branch_detail.html @@ -51,7 +51,7 @@ {% if budgets %} {% for budget in budgets %}
-

{{ budget.activity.name }} - 总预算: ¥{{ budget.total_budget }}

+

{{ budget.name }} - 总预算: ¥{{ budget.total_budget }}

diff --git a/fzjgact/huodong/templates/branch_info.html b/fzjgact/huodong/templates/branch_info.html index 39a61c6..2b4996e 100644 --- a/fzjgact/huodong/templates/branch_info.html +++ b/fzjgact/huodong/templates/branch_info.html @@ -1,59 +1,67 @@ -{% extends 'base.html' %} - - -{% block content %} - - - - - - - - - - {% for item in branches %} - - - - - - - {% endfor %} - - - - - - -
- 分支机构名称 -
- 基础信息 -
- 信息系统类别 -
- - {{ item.name }} - - - {{ item.category }} -
- -
- -
+{% extends 'base.html' %} + + +{% block content %} + + + + + + + + + + {% for item in branches %} + + + + + + + {% endfor %} + + + + + + + + + + +
+ 分支机构名称 +
+ 基础信息 +
+ 信息系统类别 +
+ + {{ item.name }} + + + {{ item.category }} +
+ 分支机构类别统计 + + A型: {{ type_a_count }}家 | B型: {{ type_b_count }}家 | C型: {{ type_c_count }}家 +
+ +
+ +
{% endblock %} \ No newline at end of file diff --git a/fzjgact/huodong/views.py b/fzjgact/huodong/views.py index dd7f4d0..93d831e 100644 --- a/fzjgact/huodong/views.py +++ b/fzjgact/huodong/views.py @@ -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)