Django模板语言 - 同一行中的多个变量?

时间:2017-09-20 17:18:06

标签: django

这看起来像是一个基本概念,但作为一个Django初学者,我无法在任何地方找到答案。

是什么意思:

Option Explicit

Public Sub colorGraph()

    Dim sld As Slide
    Dim shpe As Shape
    Dim pres As Object
    Dim nPoint As Long
    Dim iPoint As Long
    Dim c As Chart
    Dim s As Series

    Set pres = ActivePresentation

    For Each sld In pres.Slides
        For Each shpe In sld.Shapes

        Set s = shpe.Chart.SeriesCollection(1) 

        If Not shpe.HasChart Then GoTo nxtShpe
        If Not shpe.Chart.ChartType = xlColumnClustered Then GoTo nxtShpe
        If s.DataLabels.NumberFormat = "0%" Or s.DataLabels.NumberFormat = "0.0%" Or s.DataLabels.NumberFormat = "0.00%" Then GoTo nxtShpe

            nPoint = s.Points.Count

            For iPoint = 1 To nPoint
                If s.Values(iPoint) >= 8 Then
                    s.Points(iPoint).Interior.Color = RGB(0, 255, 0)
                ElseIf s.Values(iPoint) < 8 And s.Values(iPoint) >= 2 Then
                    s.Points(iPoint).Interior.Color = RGB(255, 0, 0)
                ElseIf s.Values(iPoint) < 2 And s.Values(iPoint) > 0 Then
                    s.Points(iPoint).Interior.Color = RGB(0, 0, 255)
                End If
            Next iPoint            

nxtShpe:

        Next shpe
    Next sld
End Sub

该行是否只是“打印”每个变量的值的页面?

1 个答案:

答案 0 :(得分:1)

当您在模板中看到{% / %}时,这是一个模板标记,它的操作类似于一个函数。第一个组件(上面的varname1)是标记的名称,其余组件是参数。如果模板标签返回结果,则将其注入模板。这里有更多信息:https://docs.djangoproject.com/en/1.11/howto/custom-template-tags/#writing-custom-template-tags