'Django template won't display my model variants

Sorry I'm new to Django and programming in general but I'm trying to call on variables from my model to be displayed on a specific page. I mapped my URLs to example.com/archive/book_slug and would like the details like title, author, ISBN, or whatever. I used the blog app to register my models in the admin page.

The problem occurs in my template when I go to the URL nothing gets displayed. I want the title of the book to appear in the header. Can anyone help please?

blog/models.py

from django.db import models

class Book_item(models.Model):
   book_title = models.CharField(max_length=255, blank=False)
   book_author = models.CharField(max_length=255)   
   book_publisher = models.CharField(max_length=255, blank=True)
   book_date_published = models.IntegerField(blank=True)
   book_isbn = models.IntegerField(blank=True)
   book_slug = models.SlugField(max_length=255, unique=True, blank=False,
                                primary_key=True)
   book_body = models.TextField(blank=True)

def __unicode__(self):
    return self.book_title

blog/views.py

from django.shortcuts import render, get_object_or_404
from blog.models import Book_item

# view for /achive/; template at archive.html
def archive_index(request):
    book_info = Book_item.objects.all()
    context = {'book_info' : book_info} 
    return render(request, 'blog/archive.html', context)

# view for /archive/book_title; 404 if no title; template at book_detail.html
def book_details(request, book_slug):
    bookdeets = Book_item.objects.filter(book_slug=book_slug)
    details = get_object_or_404(Book_item, book_slug=book_slug)
    context = {'details' : details, 'bookdeets' : bookdeets}
    return render(request, 'blog/book_detail.html', context)

blog/urls.py

from django.conf.urls import patterns, url
from blog import views

urlpatterns = patterns('',

    # archive index at /archive/                   
    url(r'^$', views.archive_index),

    # book deatils at /archive/book_title
    url(r'^(?P<book_slug>[\w-]+)/$', views.book_details),

 )

blog/book_detail.html

{% extends "base.html" %}

{% block title %}{{Book_item.book_title}}{% endblock %}

{% block headercontent %}
<h1>{{Book_item.book_title}}</h1>
{% endblock %}


Solution 1:[1]

try using your model name in lower case.

<h1>{{ book_item.book_title }}</h1>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Shubham J