Python Forum
<title> django page title dynamic and other field (not working)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
<title> django page title dynamic and other field (not working)
#1
Hello , my name luigi from italy age 39 old year .. my studing hobby web programming for django web framework.
my problem not work in template <title>blcok code and other row.

only model photo .. not working model Album in album_detail.html

showing :

{{album.title}}

idea? how to fixed ?? django 3.2

"""
album.html 
"""
{% extends "site/common.album.html" %}
{% load static %}
{% block title %} Album {% endblock %}
{% block content %}
<div class="row" >
{% for albumData in album  %}
  <div class="col-sm-4"  style="padding-top:30px;">
    <div class="card"> 
      <div class="card-body">
        <h5 class="card-title">{{albumData.titolo }}</h5>
        <p class="card-text">{{albumData.descrizione }}</p>
        <a href="{{albumData.id }}/">Accedi</a>
      </div>
    </div>
  </div>
{% empty %}
<div>No album</div>
{% endfor %}
</div>
 
{% endblock content %}
 
""" 
album_detail.html 
"""
 
{% extends "site/common.photo.html" %}
{% load static %}
 
{% block title %} Foto {% endblock title %}
{% block content %}
<h1 class="display-1 text-center">Foto</h1>
<h3>{{album.titolo}}</h3>
<div id="photo">
          <ul class="album album_1">
            {% for photoData in photo %}
            <li><figure class="figure">
              <a href="/public/{{photoData.foto.large }}" class="big"><img src="/public/{{photoData.foto.thumbnail }}" class="figure-img img-fluid rounded big" alt="{{photoData.titolo }}" title="{{photoData.descrizione }}"></a>
              <figcaption class="figure-caption text-center">{{photoData.descrizione }}</figcaption>
            </figure>
          </li>
          {% empty %}
          <div>No photo</div>
          {% endfor %}
        </ul>  
</div>
</div>
{% endblock content %}

"""
views.py
"""
from django.shortcuts import render
from .models import Album, Photo
 
def view_album(request):
    album = Album.objects.all().order_by('creato')
    context = {'album': album}
    return render(request, "album.html", context)
 
def view_photo(request, album_id):
    photo = Photo.objects.filter(album_id=album_id).all().order_by('creato')
    context = {'photo': photo}
    return render(request, "album_detail.html", context)
Reply


Messages In This Thread
<title> django page title dynamic and other field (not working) - by lemonred - Nov-03-2021, 05:08 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Not getting Info(Title) yrstruly 1 1,760 Jan-25-2023, 10:24 PM
Last Post: snippsat
  Parsing html page and working with checkbox (on a captcha) straannick 17 11,282 Feb-04-2021, 02:54 PM
Last Post: snippsat
  Getting a list in dynamic page probottpric 1 1,785 Oct-12-2020, 01:11 AM
Last Post: Larz60+
  css not working in Django mp3909 3 3,748 Jul-06-2020, 02:34 PM
Last Post: mp3909
  [Django] css file is not applying to the page SheeppOSU 1 3,069 May-09-2020, 06:54 AM
Last Post: menator01
  use Xpath in Python :: libxml2 for a page-to-page skip-setting apollo 2 3,626 Mar-19-2020, 06:13 PM
Last Post: apollo
  Django Two blocks of dynamic content on one page iFunKtion 5 4,404 Jul-04-2019, 02:31 AM
Last Post: noisefloor
  Django: How to automatically substitute a variable in the admin page at Django 1.11? m0ntecr1st0 3 3,305 Jun-30-2019, 12:21 AM
Last Post: scidam
  pull streams from Twitch with a keyword in title maddensplayers 1 2,160 Feb-18-2019, 03:19 AM
Last Post: SheeppOSU
  Sorting getting off, when I switch page Django 1.11 m0ntecr1st0 0 1,976 Feb-12-2019, 06:40 PM
Last Post: m0ntecr1st0

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020