Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
trishamillena_reading
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Trisha Angel Millena
trishamillena_reading
Commits
6d39344a
Commit
6d39344a
authored
Mar 28, 2023
by
Trisha Angel Millena
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Edited models.py and urls.py, Edited books.html and authors.html
parent
9cb3c5b3
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
34 additions
and
12 deletions
+34
-12
models.cpython-39.pyc
...llena_reading/bookshelf/__pycache__/models.cpython-39.pyc
+0
-0
urls.cpython-39.pyc
...millena_reading/bookshelf/__pycache__/urls.cpython-39.pyc
+0
-0
views.cpython-39.pyc
...illena_reading/bookshelf/__pycache__/views.cpython-39.pyc
+0
-0
models.py
trishamillena_reading/bookshelf/models.py
+4
-2
author_details.html
...reading/bookshelf/templates/bookshelf/author_details.html
+7
-2
authors.html
...illena_reading/bookshelf/templates/bookshelf/authors.html
+14
-2
books.html
...amillena_reading/bookshelf/templates/bookshelf/books.html
+3
-0
urls.py
trishamillena_reading/bookshelf/urls.py
+4
-4
views.py
trishamillena_reading/bookshelf/views.py
+2
-2
No files found.
trishamillena_reading/bookshelf/__pycache__/models.cpython-39.pyc
View file @
6d39344a
No preview for this file type
trishamillena_reading/bookshelf/__pycache__/urls.cpython-39.pyc
View file @
6d39344a
No preview for this file type
trishamillena_reading/bookshelf/__pycache__/views.cpython-39.pyc
View file @
6d39344a
No preview for this file type
trishamillena_reading/bookshelf/models.py
View file @
6d39344a
from
django.db
import
models
from
django.db
import
models
from
django.urls
import
reverse
# Create your models here.
# Create your models here.
...
@@ -13,7 +15,7 @@ class Author(models.Model):
...
@@ -13,7 +15,7 @@ class Author(models.Model):
return
self
.
first_name
+
' '
+
self
.
last_name
return
self
.
first_name
+
' '
+
self
.
last_name
def
get_absolute_url
(
self
):
def
get_absolute_url
(
self
):
return
reverse
(
'author-detail'
,
kwargs
=
{
'pk'
:
self
.
pk
},
)
return
reverse
(
"bookshelf:author-details"
,
kwargs
=
{
"pk"
:
self
.
pk
}
)
class
Books
(
models
.
Model
):
class
Books
(
models
.
Model
):
title
=
models
.
CharField
(
max_length
=
100
)
title
=
models
.
CharField
(
max_length
=
100
)
...
@@ -27,4 +29,4 @@ class Books(models.Model):
...
@@ -27,4 +29,4 @@ class Books(models.Model):
return
self
.
title
return
self
.
title
def
get_absolute_url
(
self
):
def
get_absolute_url
(
self
):
return
reverse
(
'book
-detail'
,
kwargs
=
{
'pk'
:
self
.
pk
},
)
return
reverse
(
'book
shelf:book-details'
,
kwargs
=
{
'pk'
:
self
.
pk
}
)
\ No newline at end of file
trishamillena_reading/bookshelf/templates/bookshelf/author_details.html
View file @
6d39344a
...
@@ -2,8 +2,13 @@
...
@@ -2,8 +2,13 @@
{% load static %}
{% load static %}
{% block title %} {% endblock %}
{% block title %}My Favorite Authors{% endblock %}
{% block content %}
{% block content %}
<h1>
Trisha's Favorite Authors
</h1>
<ul>
{% for object in object_list %}
<li
style =
"list-style-type: circle"
>
</ul>
{% endblock %}
{% endblock %}
\ No newline at end of file
trishamillena_reading/bookshelf/templates/bookshelf/authors.html
View file @
6d39344a
...
@@ -2,8 +2,20 @@
...
@@ -2,8 +2,20 @@
{% load static %}
{% load static %}
{% block title %} {% endblock %}
{% block title %}My Favorite Authors{% endblock %}
{% block content %}
{% block content %}
<h1>
Trisha's Favorite Authors
</h1>
<ul>
{% for object in object_list %}
<li>
<a
href =
'{{ object.get_absolute_url }}'
>
{{ object.first_name }}
</a>
</li>
{% endfor %}
</ul>
<a
href=
'/bookshelf/home/'
>
Home
</a>
<a
href=
'/bookshelf/authors/'
>
Books
</a>
{% endblock %}
{% endblock %}
\ No newline at end of file
trishamillena_reading/bookshelf/templates/bookshelf/books.html
View file @
6d39344a
...
@@ -16,4 +16,7 @@
...
@@ -16,4 +16,7 @@
{% endfor %}
{% endfor %}
</ul>
</ul>
<a
href=
'/bookshelf/home/'
>
Home
</a>
<a
href=
'/bookshelf/authors/'
>
Authors
</a>
{% endblock %}
{% endblock %}
\ No newline at end of file
trishamillena_reading/bookshelf/urls.py
View file @
6d39344a
from
django.urls
import
path
from
django.urls
import
path
from
.views
import
(
from
.views
import
(
home
,
Book
ListView
,
Book
DetailView
,
AuthorListView
,
AuthorDetailView
home
,
Book
sListView
,
Books
DetailView
,
AuthorListView
,
AuthorDetailView
)
)
urlpatterns
=
[
urlpatterns
=
[
path
(
'home/'
,
home
,
name
=
'home'
),
path
(
'home/'
,
home
,
name
=
'home'
),
path
(
'books/'
,
Book
ListView
.
as_view
(),
name
=
'book-details
'
),
path
(
'books/'
,
Book
sListView
.
as_view
(),
name
=
'books-list
'
),
path
(
'books/<int:pk>/details'
,
BookDetailView
.
as_view
(),
name
=
'book-details'
),
path
(
'books/<int:pk>/details'
,
Book
s
DetailView
.
as_view
(),
name
=
'book-details'
),
path
(
'authors/'
,
AuthorListView
.
as_view
(),
name
=
'author-list'
),
path
(
'authors/'
,
AuthorListView
.
as_view
(),
name
=
'author-list'
),
path
(
'author/<int:pk>/details'
,
AuthorDetailView
.
as_view
(),
name
=
'author-details'
),
path
(
'author
s
/<int:pk>/details'
,
AuthorDetailView
.
as_view
(),
name
=
'author-details'
),
]
]
app_name
=
"bookshelf"
app_name
=
"bookshelf"
\ No newline at end of file
trishamillena_reading/bookshelf/views.py
View file @
6d39344a
...
@@ -9,11 +9,11 @@ from .models import Author, Books
...
@@ -9,11 +9,11 @@ from .models import Author, Books
def
home
(
request
):
def
home
(
request
):
return
render
(
request
,
'bookshelf/home.html'
)
return
render
(
request
,
'bookshelf/home.html'
)
class
BookListView
(
ListView
):
class
Book
s
ListView
(
ListView
):
model
=
Books
model
=
Books
template_name
=
'bookshelf/books.html'
template_name
=
'bookshelf/books.html'
class
BookDetailView
(
DetailView
):
class
Book
s
DetailView
(
DetailView
):
model
=
Books
model
=
Books
template_name
=
'bookshelf/book_details.html'
template_name
=
'bookshelf/book_details.html'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment