Django templates and variable attributes

后端 未结 6 546
忘掉有多难
忘掉有多难 2020-12-02 13:43

I\'m using Google App Engine and Django templates.
I have a table that I want to display the objects look something like:

Object Result:
    Items =          


        
6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-02 14:04

    @Dave Webb (i haven't been rated high enough to comment yet)

    The dot lookups can be summarized like this: when the template system encounters a dot in a variable name, it tries the following lookups, in this order:

    * Dictionary lookup (e.e., foo["bar"])
    * Attribute lookup (e.g., foo.bar)
    * Method call (e.g., foo.bar())
    * List-index lookup (e.g., foo[bar])
    

    The system uses the first lookup type that works. It’s short-circuit logic.

提交回复
热议问题