Commit 75d8be12 authored by Joei Yucoco's avatar Joei Yucoco

Populated models and cleaned up code

- removed unnecessary comments
parent 6326bbe6
No preview for this file type
...@@ -27,9 +27,6 @@ class Author(models.Model,URLFunctions): ...@@ -27,9 +27,6 @@ class Author(models.Model,URLFunctions):
def get_absolute_detail_url(self): def get_absolute_detail_url(self):
return reverse('bookshelf:authors-detail', kwargs={'pk':self.pk}) return reverse('bookshelf:authors-detail', kwargs={'pk':self.pk})
#def get_absolute_list_url(self):
#return reverse('bookshelf:authors-list')
class Books(models.Model,URLFunctions): class Books(models.Model,URLFunctions):
title = models.CharField(max_length=100) title = models.CharField(max_length=100)
...@@ -45,7 +42,3 @@ class Books(models.Model,URLFunctions): ...@@ -45,7 +42,3 @@ class Books(models.Model,URLFunctions):
def get_absolute_detail_url(self): def get_absolute_detail_url(self):
return reverse('bookshelf:books-detail', kwargs={'pk':self.pk}) return reverse('bookshelf:books-detail', kwargs={'pk':self.pk})
#def get_absolute_list_url(self):
#return reverse('bookshelf:books-list')
# Create your models here.
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
<br>
<h3> <h3>
<a href="{{ object.get_absolute_home_url }}" > <a href="{{ object.get_absolute_home_url }}" >
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
<br>
<h3> <h3>
<a href="{{ object_list.0.get_absolute_home_url }}" > <a href="{{ object_list.0.get_absolute_home_url }}" >
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
<h3>{{object.year_published}}</h3> <h3>{{object.year_published}}</h3>
<h3>{{object.ISBN}}</h3> <h3>{{object.ISBN}}</h3>
<h3>{{object.blurb}}</h3> <h3>{{object.blurb}}</h3>
<br>
<h3> <h3>
<a href="{{ object.get_absolute_home_url }}" > <a href="{{ object.get_absolute_home_url }}" >
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
<br>
<h3> <h3>
<a href="{{ object_list.0.get_absolute_home_url }}" > <a href="{{ object_list.0.get_absolute_home_url }}" >
......
...@@ -6,9 +6,6 @@ from django.views.generic.detail import DetailView ...@@ -6,9 +6,6 @@ from django.views.generic.detail import DetailView
from .models import Author, Books from .models import Author, Books
#def index(request):
#return HttpResponse('Hello World!')
def HomeView(request): def HomeView(request):
return render(request, 'bookshelf/home.html', { return render(request, 'bookshelf/home.html', {
'book': Books, 'book': Books,
...@@ -33,11 +30,3 @@ class AuthorDetailsView(DetailView): ...@@ -33,11 +30,3 @@ class AuthorDetailsView(DetailView):
model = Author model = Author
template_name = 'bookshelf/author_details.html' template_name = 'bookshelf/author_details.html'
#class HomeView(View):
#def get(self, request):
#return render(request, 'bookshelf/home.html', {})
# Create your views here.
...@@ -15,12 +15,8 @@ Including another URLconf ...@@ -15,12 +15,8 @@ Including another URLconf
""" """
from django.contrib import admin from django.contrib import admin
from django.urls import include, path from django.urls import include, path
#from bookshelf.views import HomeView
urlpatterns = [ urlpatterns = [
#path('home/', include('bookshelf.urls', namespace="home")),
#path('home/', HomeView.as_view(), name='home'),
#path('bookshelf/', include('bookshelf.urls', namespace="bookshelf")),
path('', include('bookshelf.urls', namespace="basic")), path('', include('bookshelf.urls', namespace="basic")),
path('admin/', admin.site.urls), path('admin/', admin.site.urls),
] ]
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