Add JavaScript File through Static Folder and Demonstrate Button Action

πŸ“Œ Introduction Django supports JavaScript via static files. πŸ‘‰ We use JS to: Handle button clicks Show alerts Add interactivity 🎯 Program Statement πŸ‘‰ Add a JavaScript file through static folder and demonstrate button action. 🧠 Concept πŸ‘‰ Static folder can store: CSS JS Images βš™οΈ Step 1: Static Folder Structure πŸ“ Project Structure: myproject/ static/ js/ script.js βš™οΈ Step […]

Display Image from Static Folder using {% static %}

πŸ“Œ Introduction In Django, images are also static files.We store them inside the static/ folder and load them using: πŸ‘‰ {% static %} 🎯 Program Statement πŸ‘‰ Display an image from the static folder using {% static %}. 🧠 Concept πŸ‘‰ Static folder can store: CSS JS Images βš™οΈ Step 1: Static Folder Structure πŸ“ Project Structure: myproject/ static/ images/ […]

Configure Static Files and Apply External CSS to a Template

πŸ“Œ Introduction In Django, static files include: CSS JavaScript Images πŸ‘‰ These files are stored separately and loaded using {% static %}. 🎯 Program Statement πŸ‘‰ Configure static files and apply external CSS to a template. 🧠 Why Static Files Are Important Styling (CSS) Interactivity (JS) UI Design βš™οΈ Step 1: Configure Static Settings πŸ“ File: settings.py πŸ”Ή Path: myproject/myproject/settings.py […]

Demonstrate Template Filters

πŸ“Œ Introduction Django provides template filters to modify data before displaying it. πŸ‘‰ Filters are used with | operator. 🎯 Program Statement πŸ‘‰ Demonstrate template filters such as upper, lower, length, and date. 🧠 What are Template Filters? πŸ‘‰ Template filters: Transform data Format output Improve display βš™οΈ Step 1: Create View πŸ“ File: views.py πŸ”Ή Path: myproject/myapp/views.py πŸ”Ή Code: […]

Display Attendance Report with Conditional Status inside a Loop

πŸ“Œ Introduction In real applications like: Student portals LMS systems We need to display: Attendance % Status (Present / Short Attendance) πŸ‘‰ This is done using: {% for %} β†’ loop {% if %} β†’ condition 🎯 Program Statement πŸ‘‰ Display attendance report with conditional status inside a loop. 🧠 Problem Logic πŸ‘‰ Condition: If attendance β‰₯ 75 β†’ Eligible […]

Display Product Details in Table Format using Template Loop

πŸ“Œ Introduction In Django templates, we can display structured data like: Product lists Student records Reports πŸ‘‰ using: {% for %} loop HTML tables 🎯 Program Statement πŸ‘‰ Display product details in table format using template loop. 🧠 Problem Logic We will: Create product data (list of dictionaries) Loop through it Display in table βš™οΈ Step 1: Create View πŸ“ […]

Display Marks List and Pass/Fail Result using {% for %} and {% if %}

πŸ“Œ Introduction In Django templates, we can combine: {% for %} β†’ to loop through list {% if %} β†’ to apply condition πŸ‘‰ This allows us to: Process multiple values Apply logic to each value 🎯 Program Statement πŸ‘‰ Display marks list and pass/fail result using {% for %} and {% if %}. 🧠 Problem Logic For each mark: […]

Display Eligibility Status using {% if %} Condition in Django Templates

πŸ“Œ Introduction In Django templates, we can apply conditions using: πŸ‘‰ {% if %} This allows us to: Check conditions Display output dynamically Implement decision-making logic 🎯 Program Statement πŸ‘‰ Display eligibility status using {% if %} condition in templates. 🧠 Problem Logic πŸ‘‰ Condition: If marks β‰₯ 40 β†’ Pass / Eligible Else β†’ Fail / Not Eligible βš™οΈ […]

Use {% include %} to Reuse Header and Footer Templates

πŸ“Œ Introduction In Django, instead of writing header/footer repeatedly, we use: πŸ‘‰ {% include %} This helps: Reuse code Maintain consistency Reduce duplication 🎯 Program Statement πŸ‘‰ Use {% include %} to reuse header and footer templates. 🧠 Concept Overview Tag Purpose {% include %} Insert another template {% extends %} Inherit full layout πŸ‘‰ Difference: include β†’ partial reuse […]