{"id":75289,"date":"2020-01-18T14:12:23","date_gmt":"2020-01-18T08:42:23","guid":{"rendered":"https:\/\/www.vskills.in\/certification\/tutorial\/?p=75289"},"modified":"2024-04-12T14:17:12","modified_gmt":"2024-04-12T08:47:12","slug":"philosophies-and-limitations","status":"publish","type":"page","link":"https:\/\/www.vskills.in\/certification\/tutorial\/philosophies-and-limitations\/","title":{"rendered":"Philosophies and Limitations"},"content":{"rendered":"<p>Now that you\u2019ve gotten a feel for the Django Template Language (DTL), it\u2019s probably time to explain the basic design philosophy behind the DTL. First and foremost, the limitations to the DTL are intentional.<\/p>\n<p>Django was developed in the high volume, ever-changing environment of an online newsroom. The original creators of Django had a very definite set of philosophies in creating the DTL. These philosophies remain core to Django today. They are:<\/p>\n<ul>\n<li>Separate logic from presentation &#8211; A template system is a tool that controls presentation and presentation-related logic \u2013 and that\u2019s it. The template system shouldn\u2019t support functionality that goes beyond this basic goal.<\/li>\n<li>Discourage redundancy &#8211; The majority of dynamic web sites use some sort of common site-wide design \u2013 a common header, footer, navigation bar, etc. The Django template system should make it easy to store those elements in a single place, eliminating duplicate code. This is the philosophy behind template inheritance.<\/li>\n<li>Be decoupled from HTML &#8211; The template system shouldn\u2019t be designed so that it only outputs HTML. It should be equally good at generating other text-based formats, or just plain text.<\/li>\n<li>XML should not be used for template languages &#8211; Using an XML engine to parse templates introduces a whole new world of human error in editing templates \u2013 and incurs an unacceptable level of overhead in template processing.<\/li>\n<li>Assume designer competence &#8211; The template system shouldn\u2019t be designed so that templates necessarily are displayed nicely in WYSIWYG editors such as Dreamweaver. That is too severe of a limitation and wouldn\u2019t allow the syntax to be as nice as it is. Django expects template authors are comfortable editing HTML directly.<\/li>\n<li>Treat whitespace obviously &#8211; The template system shouldn\u2019t do magic things with whitespace. If a template includes whitespace, the system should treat the whitespace as it treats text \u2013 just display it. Any whitespace that\u2019s not in a template tag should be displayed.<\/li>\n<li>Don\u2019t invent a programming language &#8211; The template system intentionally doesn\u2019t allow the following &#8211; assignment to variables and advanced logic. The goal is not to invent a programming language. The goal is to offer just enough programming-esque functionality, such as branching and looping, that is essential for making presentation-related decisions. The Django template system recognizes that templates are most often written by designers, not programmers, and therefore should not assume Python knowledge.<\/li>\n<li>Safety and security &#8211; The template system, out of the box, should forbid the inclusion of malicious code \u2013 such as commands that delete database records. This is another reason why the template system doesn\u2019t allow arbitrary execution of Python code.<\/li>\n<li>Extensibility &#8211; The template system should recognize that advanced template authors may want to extend its technology. This is the philosophy behind custom template tags and filters.<\/li>\n<\/ul>\n<h3>DTL Philosophy \u2013 Concluding Thoughts<\/h3>\n<p>Having worked with many different templating systems myself over the years, I whole-heartedly endorse this approach \u2013 the DTL and the way it has been designed is one of the major pluses of the Django framework.<\/p>\n<p>When the pressure is on to Get Stuff Done, and you have both designers and programmers trying to communicate and get all the of the last minute tasks done, Django just gets out of the way and lets each team concentrate on what they are good at.<\/p>\n<p>Once you have found this out for yourself through real-life practice, you will find out very quickly why Django really is the \u201cframework for perfectionists with deadlines\u201d.<\/p>\n<p>More than any other component of web applications, template syntax is highly subjective, and programmers\u2019 opinions vary wildly. The fact that Python alone has dozens, if not hundreds, of open source template-language implementations supports this point. Each was likely created because its developer deemed all existing template languages inadequate.<\/p>\n<p>With all this in mind, Django is flexible \u2013 it does not require you to use the DTL. All of the most recent versions of Django, including Django 1.11, ship with the popular Jinja2 template engine as well as the DTL to provide developers with options.<\/p>\n<p>Because Django is intended to be a full-stack web framework that provides all the pieces necessary for web developers to be productive, most times it\u2019s more convenient to use the DTL, but it\u2019s not a strict requirement in any sense.<\/p>\n\n\n<p><a href=\"https:\/\/www.vskills.in\/certification\/tutorial\/certified-django-developer\/\" target=\"_blank\" rel=\"noreferrer noopener\">Back to Tutorial<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Now that you\u2019ve gotten a feel for the Django Template Language (DTL), it\u2019s probably time to explain the basic design philosophy behind the DTL. First and foremost, the limitations to the DTL are intentional. Django was developed in the high volume, ever-changing environment of an online newsroom. The original creators of Django had a very&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[8655],"tags":[8666],"class_list":["post-75289","page","type-page","status-publish","hentry","category-django-web-development","tag-philosophies-and-limitations"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Philosophies and Limitations - Tutorial<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.vskills.in\/certification\/tutorial\/philosophies-and-limitations\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Philosophies and Limitations - Tutorial\" \/>\n<meta property=\"og:description\" content=\"Now that you\u2019ve gotten a feel for the Django Template Language (DTL), it\u2019s probably time to explain the basic design philosophy behind the DTL. First and foremost, the limitations to the DTL are intentional. Django was developed in the high volume, ever-changing environment of an online newsroom. The original creators of Django had a very...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.vskills.in\/certification\/tutorial\/philosophies-and-limitations\/\" \/>\n<meta property=\"og:site_name\" content=\"Tutorial\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/vskills.in\/\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-12T08:47:12+00:00\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/philosophies-and-limitations\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/philosophies-and-limitations\/\",\"name\":\"Philosophies and Limitations - Tutorial\",\"isPartOf\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\"},\"datePublished\":\"2020-01-18T08:42:23+00:00\",\"dateModified\":\"2024-04-12T08:47:12+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/philosophies-and-limitations\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.vskills.in\/certification\/tutorial\/philosophies-and-limitations\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/philosophies-and-limitations\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Philosophies and Limitations\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"name\":\"Tutorial\",\"description\":\"Vskills - A initiative in elearning and certification\",\"publisher\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\",\"name\":\"Vskills\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"contentUrl\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"width\":73,\"height\":55,\"caption\":\"Vskills\"},\"image\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/vskills.in\/\",\"https:\/\/x.com\/vskills_in\",\"https:\/\/www.linkedin.com\/company-beta\/1371554\/\",\"https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Philosophies and Limitations - Tutorial","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.vskills.in\/certification\/tutorial\/philosophies-and-limitations\/","og_locale":"en_US","og_type":"article","og_title":"Philosophies and Limitations - Tutorial","og_description":"Now that you\u2019ve gotten a feel for the Django Template Language (DTL), it\u2019s probably time to explain the basic design philosophy behind the DTL. First and foremost, the limitations to the DTL are intentional. Django was developed in the high volume, ever-changing environment of an online newsroom. The original creators of Django had a very...","og_url":"https:\/\/www.vskills.in\/certification\/tutorial\/philosophies-and-limitations\/","og_site_name":"Tutorial","article_publisher":"https:\/\/www.facebook.com\/vskills.in\/","article_modified_time":"2024-04-12T08:47:12+00:00","twitter_misc":{"Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/philosophies-and-limitations\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/philosophies-and-limitations\/","name":"Philosophies and Limitations - Tutorial","isPartOf":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website"},"datePublished":"2020-01-18T08:42:23+00:00","dateModified":"2024-04-12T08:47:12+00:00","breadcrumb":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/philosophies-and-limitations\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.vskills.in\/certification\/tutorial\/philosophies-and-limitations\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/philosophies-and-limitations\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.vskills.in\/certification\/tutorial\/"},{"@type":"ListItem","position":2,"name":"Philosophies and Limitations"}]},{"@type":"WebSite","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","name":"Tutorial","description":"Vskills - A initiative in elearning and certification","publisher":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization","name":"Vskills","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","contentUrl":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","width":73,"height":55,"caption":"Vskills"},"image":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/vskills.in\/","https:\/\/x.com\/vskills_in","https:\/\/www.linkedin.com\/company-beta\/1371554\/","https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw"]}]}},"_links":{"self":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/75289","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/comments?post=75289"}],"version-history":[{"count":4,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/75289\/revisions"}],"predecessor-version":[{"id":83334,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/75289\/revisions\/83334"}],"wp:attachment":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/media?parent=75289"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/categories?post=75289"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/tags?post=75289"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}