Commit 7c0950c1 authored by MJoshBen's avatar MJoshBen

Created the Base Template and also Updated Models.py to Implement the Reverse Function

parent 0703620e
......@@ -12,6 +12,11 @@ class Author(models.Model):
def __str__(self):
return '{}, {}'.format(self.last_name, self.first_name)
def get_absolute_url(self):
return reverse('bookshelf:author-details', kwargs={'pk':self.pk})
class Books(models.Model):
title = models.CharField(max_length=100)
......@@ -26,5 +31,9 @@ class Books(models.Model):
def __str__(self):
return '{}'.format(self.title)
def get_absolute_url(self):
return reverse('bookshelf:book-details', kwargs={'pk':self.pk})
......@@ -55,7 +55,7 @@ ROOT_URLCONF = 'joshbenito_reading.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
......
<html lang="en">
<head>
<title>{% block title %}{% endblock %}</title>
</head>
<body>
<div id="content">
{% block content %}{% endblock %}
</div>
{% block scripts %}{% endblock %}
</body>
</html>
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