Book Image

Django 1.0 Template Development

Book Image

Django 1.0 Template Development

Overview of this book

Table of Contents (17 chapters)
Django 1.0 Template Development
Credits
About the Author
About the Reviewers
Preface
Index

Summary


In this chapter, we learned how to write our own custom tags and filters to extend the default functionality of the Django template system. We looked at the structure of the built-in tags and filters as a starting point for creating our own.

We explored how template filters are constructed and registered by the template system. We also saw how they are loaded and called in the template, and how to pass an argument to a filter.

We wrote our own filters to format U.S. currency values, remove profanities from text, and see if a value was present in a list.

We looked at the structure of template tags, seeing how they have a two-step process of compiling and returning a node. We learned how arguments are passed to templates and how to parse them into their values. We also saw how to pass template variables as arguments to tags and to add new context variables inside a tag.

This chapter was much more involved than others we have worked with. Be proud of getting through these more advanced...