Commit eb95db7f authored by Jan Ericsson Ong Ang's avatar Jan Ericsson Ong Ang

added comment for views.py

parent c856c66d
...@@ -10,6 +10,7 @@ from .models import Author, Books ...@@ -10,6 +10,7 @@ from .models import Author, Books
def HomeView(request): def HomeView(request):
return render(request, 'bookshelf/home.html', {'nickname': 'Jan'}) return render(request, 'bookshelf/home.html', {'nickname': 'Jan'})
#CBV
class AuthorView(ListView): class AuthorView(ListView):
model = Author model = Author
queryset = Author.objects.all() queryset = Author.objects.all()
...@@ -17,7 +18,6 @@ class AuthorView(ListView): ...@@ -17,7 +18,6 @@ class AuthorView(ListView):
author_data = Author.objects.all().values() author_data = Author.objects.all().values()
return render(request, 'bookshelf/authors.html', {'nickname': 'Jan', 'author_data': author_data}) return render(request, 'bookshelf/authors.html', {'nickname': 'Jan', 'author_data': author_data})
#CBV
class AuthorDetailView(DetailView): class AuthorDetailView(DetailView):
pk_url_kwarg = 'id' pk_url_kwarg = 'id'
model = Author model = Author
......
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