If you need a functionality that is too sophisticated for a filter, it should be a template tag. These are of several kinds, such as simple_tag for basic functionality and a template inclusion tag to bring in entire templates.
- Template tags are a lot like filters,…so make sure you've got a firm understanding…of the last video's content.…In this video we'll cover creating template tags.…Tags can do more than filters can,…and they make it easier to do more complicated things.…For example, one of the filter examples…was to display YouTube embed code.…In reality, I would use a tag for that.…Tags come in a few varieties,…and there are two common varieties.…They can simply process a little data and return it,…or they can include and render templates, much like a view.…We'll cover both of these styles.…Kevin and I are both big fans of the bootstrap toolkit…so we'll create two template tags…that can make using bootstrap easier.…
Bootstrap is a set of CSS and HTML…that gives you nice, professional, and clean-looking pages.…If you're like me, the first thing I do…when prototyping a new app…is to look up the URL for a CDN for bootstrap.…Let's just make a template tag for that instead.…Like with filters, I use the register function.…This time, to register a template library.…
Django is one of the world's leading web development platforms. This Python web framework makes your app building experience smoother, faster, and easier. It is a key feature behind the success of many start-ups across the world, including Instagram and Nextdoor. This course introduces next-level advanced concepts to help you build your own professional-grade Django applications.
Author Kevin Veroneau starts off by explaining how class-based views—a powerful, but often poorly understood feature—work in Django. Then learn how to create custom middleware to help organize frequently used code. Have you ever wanted to build a complete RESTful API? Find out how to do just that, starting with a basic read-only API and then adding key-based authentication to allow the full range of CRUD functionality. Plus, discover how to use model managers and the Q method to make it easier to get the data we need to our views and clients.
For the finishing touches, dive into the details of caching to improve application performance, and then add custom management commands to help automate routine tasks.
- Extending class-based views
- Creating custom class-based views
- Managing your database with middleware
- Creating template filters and tags
- Building a RESTful API
- Modeling advanced database relationships and queries
- Using a model manager for your application