Commit 44ba6191 authored by Jan Ericsson Ong Ang's avatar Jan Ericsson Ong Ang

edited views.py

parent 847cc9bc
from django.shortcuts import render from django.shortcuts import render
from django.http import HttpResponse from django.views.generic.detail import DetailView
from django.views.generic.list import ListView
from .models import Author, Books from .models import Author, Books
from django.views import View
# Create your views here. # Create your views here.
def bookshelfIndex(request):
title = 'Landing Page Stuff<br><br>'
output_view = "" + Author + " wrote " + Books + "!"
return HttpResponse(title + output_view)
def HomeView(request):
return render(request, 'bookshelf/home.html', {'nickname': 'Jan'})
def new_view(request): class BooksView(ListView):
spotlightBook = Books.objects.all() model = Books
template_name = 'bookshelf/books.html'
class BookDetailsView(DetailView):
model = Books
template_name = 'bookshelf/books_details.html'
class HomepageView(View): class AuthorView(ListView):
return render(request, 'bookshelf/templates/home.html', {'nickname', 'Jan'} ) model = Author
\ No newline at end of file template_name = 'bookshelf/author.html'
class AuthorDetailView(DetailView):
model = Author
template_name = 'bookshelf/author_details.html'
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment