Mohamed Feddad

42%
Flag icon
>>> "Dr. Oct has {0} arms and says: {1}".format(DrOct().arms, DrOct().speak()) 'Dr. Oct has 4 arms and says: You have a train to catch.' >>> mydict["key"] 'value' >>> mylist[1] 20 In Django's template equivalent, it is as follows: Dr. Oct has {{ s.arms }} arms and says: {{ s.speak }} {{ mydict.key }} {{ mylist.1 }} Notice how speak, a method that takes no arguments except self, is treated like an attribute here.
Mohamed Feddad
Handling lookups in DTL
Django Design Patterns and Best Practices: Industry-standard web development techniques and solutions using Python, 2nd Edition
Rate this book
Clear rating