Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
almiraredoble_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
Almira Redoble
almiraredoble_reading
Commits
53f031ac
Commit
53f031ac
authored
Apr 24, 2023
by
Almira Redoble
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Created views and templates for new books and authors, configured their urls, and updated home.html
parent
ba5cebb1
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
68 additions
and
3 deletions
+68
-3
add-author.html
...ble_reading/bookshelf/templates/bookshelf/add-author.html
+25
-0
add-book.html
...doble_reading/bookshelf/templates/bookshelf/add-book.html
+25
-0
home.html
...raredoble_reading/bookshelf/templates/bookshelf/home.html
+2
-0
urls.py
almiraredoble_reading/bookshelf/urls.py
+5
-3
views.py
almiraredoble_reading/bookshelf/views.py
+11
-0
No files found.
almiraredoble_reading/bookshelf/templates/bookshelf/add-author.html
0 → 100644
View file @
53f031ac
{% extends 'base.html' %}
{% load static %}
{% block title %}
Add New Author
{% endblock %}
{% block heading %}
Add New Author
{% endblock %}
{% block content %}
{{ form.non_field_errors }}
<form
action=
"{{ object.get_absolute_url }}"
method=
"post"
>
{% csrf_token %}
{{ form }}
<input
type=
"submit"
value=
"Add Author"
>
</form>
{% endblock %}
{% block footer %}
<a
href=
"{% url 'bookshelf:home' %}"
>
Home
</a>
<a
href=
"{% url 'bookshelf:books' %}"
>
Books
</a>
<a
href=
"{% url 'bookshelf:authors' %}"
>
Authors
</a>
{% endblock %}
\ No newline at end of file
almiraredoble_reading/bookshelf/templates/bookshelf/add-book.html
0 → 100644
View file @
53f031ac
{% extends 'base.html' %}
{% load static %}
{% block title %}
Add New Book
{% endblock %}
{% block heading %}
Add New Book
{% endblock %}
{% block content %}
{{ form.non_field_errors }}
<form
action=
"{{ object.get_absolute_url }}"
method=
"post"
>
{% csrf_token %}
{{ form }}
<input
type=
"submit"
value=
"Add Book"
>
</form>
{% endblock %}
{% block footer %}
<a
href=
"{% url 'bookshelf:home' %}"
>
Home
</a>
<a
href=
"{% url 'bookshelf:books' %}"
>
Books
</a>
<a
href=
"{% url 'bookshelf:authors' %}"
>
Authors
</a>
{% endblock %}
\ No newline at end of file
almiraredoble_reading/bookshelf/templates/bookshelf/home.html
View file @
53f031ac
...
...
@@ -16,4 +16,6 @@
{% block footer %}
<a
href=
"{% url 'bookshelf:books' %}"
>
Books
</a>
<a
href=
"{% url 'bookshelf:authors' %}"
>
Authors
</a>
<a
href=
"{% url 'bookshelf:books-add' %}"
>
Add Book
</a>
<a
href=
"{% url 'bookshelf:authors-add' %}"
>
Add Author
</a>
{% endblock %}
\ No newline at end of file
almiraredoble_reading/bookshelf/urls.py
View file @
53f031ac
from
django.urls
import
path
from
.views
import
(
HomePageView
,
BookListView
,
BookDetailView
,
Author
ListView
,
AuthorDetail
View
HomePageView
,
BookListView
,
BookDetailView
,
AuthorListView
,
Author
DetailView
,
BookCreateView
,
AuthorCreate
View
)
urlpatterns
=
[
...
...
@@ -9,7 +9,9 @@ urlpatterns = [
path
(
'books/'
,
BookListView
.
as_view
(),
name
=
'books'
),
path
(
'authors/'
,
AuthorListView
.
as_view
(),
name
=
'authors'
),
path
(
'books/<int:pk>/details'
,
BookDetailView
.
as_view
(),
name
=
'book-details'
),
path
(
'authors/<int:pk>/details'
,
AuthorDetailView
.
as_view
(),
name
=
'author-details'
)
path
(
'authors/<int:pk>/details'
,
AuthorDetailView
.
as_view
(),
name
=
'author-details'
),
path
(
'books/add'
,
BookCreateView
.
as_view
(),
name
=
'books-add'
),
path
(
'authors/add'
,
AuthorCreateView
.
as_view
(),
name
=
'authors-add'
),
]
app_name
=
"bookshelf"
\ No newline at end of file
almiraredoble_reading/bookshelf/views.py
View file @
53f031ac
...
...
@@ -2,6 +2,7 @@ from django.shortcuts import render
from
django.views
import
View
from
django.views.generic.detail
import
DetailView
from
django.views.generic.list
import
ListView
from
django.views.generic.edit
import
CreateView
,
UpdateView
from
.models
import
Books
,
Author
...
...
@@ -26,6 +27,11 @@ class BookDetailView(DetailView):
model
=
Books
template_name
=
'bookshelf/book_details.html'
class
BookCreateView
(
CreateView
):
model
=
Books
fields
=
'__all__'
template_name
=
'bookshelf/add-book.html'
class
AuthorListView
(
ListView
):
model
=
Author
template_name
=
'bookshelf/authors.html'
...
...
@@ -33,3 +39,8 @@ class AuthorListView(ListView):
class
AuthorDetailView
(
DetailView
):
model
=
Author
template_name
=
'bookshelf/author_details.html'
class
AuthorCreateView
(
CreateView
):
model
=
Author
fields
=
'__all__'
template_name
=
'bookshelf/add-author.html'
\ No newline at end of file
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