Tag: django

  • Django Static Files

    Django Static Files

    So far we have not seen any Cascading Style Sheets, JavaScript code, or Image files in our simple Django app. These types of files are referred to as static files. These types of files don’t typically change, therefore we refer to them as static. The templates that we have been working with do change since […]

  • Django Block Content

    Django Block Content

    Block Content in Django is the concept of working with Template Inheritance. As you add more templates to your project, you will notice that a lot of the markup is duplicated. Every template will have an opening <HTML> tag, an opening <head> tag, a closing </head> tag, a closing </HTML> tag and so on and […]

  • Create Dynamic Links With URL Tag In Django

    Create Dynamic Links With URL Tag In Django

    In Django, you typically want to avoid hard coding links into the application. We saw examples of this in the Named URLs and Reverse Function tutorial. The same holds true in Django templates. We do not want to hard code links in the template as they may break if the application changes in the future. […]

  • How To Use Django Tags

    How To Use Django Tags

    Tags are a key component of Django Templates and they make it possible to embed simple logic into Django templates during the rendering process. This is important because it is not possible to use raw Python in an HTML template since Python runs on the server and not in a Web Browser. Tags bridge this […]

  • Django Template Filters

    Django Template Filters

    As we saw in the interpolation tutorial, we are able to output dynamic data in Django Templates using variables the are enclosed in the special opening {{ and closing }} curly brace characters. Django also offers a way to perform various types of data formatting right in the template by use of filters. Filters are […]

  • Django Template Language Variables

    Django Template Language Variables

    The Django Template Language is a special syntax for use inside of HTML files to be used by the Django Web Framework. DTL is an enhanced form of HTML that makes use of standard HTML syntax combined with the Django Specific template language so that variable data can be dynamically injected into the template creating […]

  • Django render() Function

    Django render() Function

    Django has a plethora of so-called shortcut functions that make developing with Django easier. These shortcuts are helper functions that span many different levels of the model, view, template paradigm. The render() function is one such function. The purpose of render() is to return an HttpResponse whose content is filled with the result of calling […]