Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gabgeraldo_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
Gabriel Geraldo
gabgeraldo_reading
Commits
e9e9be93
Commit
e9e9be93
authored
Apr 25, 2023
by
Gabriel Geraldo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implemented add and edit Author features
parent
6b9af395
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
3 deletions
+53
-3
add-author.html
...ldo_reading/bookshelf/templates/bookshelf/add-author.html
+18
-0
author_details.html
...reading/bookshelf/templates/bookshelf/author_details.html
+3
-0
edit-author.html
...do_reading/bookshelf/templates/bookshelf/edit-author.html
+18
-0
urls.py
gabgeraldo_reading/bookshelf/urls.py
+3
-1
views.py
gabgeraldo_reading/bookshelf/views.py
+11
-2
No files found.
gabgeraldo_reading/bookshelf/templates/bookshelf/add-author.html
0 → 100644
View file @
e9e9be93
{% extends 'base.html' %}
{% load static %}
{% block title %} Add New Author {% endblock %}
{% block style %}
<link
rel=
'stylesheet'
type=
'text/css'
href=
"{% static 'base.css' %}"
/>
{% endblock %}
{% block content %}
<header>
Add New Author
</header>
<section>
<form
method=
"post"
>
{% csrf_token %}
{{ form.as_p }}
<input
type=
"submit"
value=
"Add Author"
>
</form>
</section>
{% endblock %}
\ No newline at end of file
gabgeraldo_reading/bookshelf/templates/bookshelf/author_details.html
View file @
e9e9be93
...
...
@@ -16,6 +16,9 @@
<li
class=
"subinfo"
>
Age: {{ object.age }}
</li>
<li
class=
"subinfo"
>
Nationality: {{ object.nationality }}
</li>
<li
class=
"subinfo"
>
Bio:
<br>
{{ object.bio}}
</li>
<form
action=
"edit"
>
<input
type=
"submit"
value=
"Edit Author"
/>
</form>
</ul>
</section>
<section>
...
...
gabgeraldo_reading/bookshelf/templates/bookshelf/edit-author.html
0 → 100644
View file @
e9e9be93
{% extends 'base.html' %}
{% load static %}
{% block title %} Edit Author {% endblock %}
{% block style %}
<link
rel=
'stylesheet'
type=
'text/css'
href=
"{% static 'base.css' %}"
/>
{% endblock %}
{% block content %}
<header>
Edit Author
</header>
<section>
<form
method=
"post"
>
{% csrf_token %}
{{ form.as_p }}
<input
type=
"submit"
value=
"Save Changes"
>
</form>
</section>
{% endblock %}
\ No newline at end of file
gabgeraldo_reading/bookshelf/urls.py
View file @
e9e9be93
from
django.urls
import
path
from
.views
import
index_view
,
home_view
,
BooksListView
,
BooksDetailView
,
BooksCreateView
,
BooksUpdateView
,
AuthorListView
,
AuthorDetailView
from
.views
import
index_view
,
home_view
,
BooksListView
,
BooksDetailView
,
BooksCreateView
,
BooksUpdateView
,
AuthorListView
,
AuthorDetailView
,
AuthorCreateView
,
AuthorUpdateView
urlpatterns
=
[
...
...
@@ -11,6 +11,8 @@ urlpatterns = [
path
(
'books/<int:pk>/edit'
,
BooksUpdateView
.
as_view
(),
name
=
"books_edit"
),
path
(
'authors/'
,
AuthorListView
.
as_view
(
template_name
=
'bookshelf/authors.html'
),
name
=
'authors'
),
path
(
'authors/<int:pk>/details'
,
AuthorDetailView
.
as_view
(
template_name
=
'bookshelf/author_details.html'
),
name
=
'author_details'
),
path
(
'authors/add'
,
AuthorCreateView
.
as_view
(),
name
=
'author_add'
),
path
(
'authors/<int:pk>/edit'
,
AuthorUpdateView
.
as_view
(),
name
=
"author_edit"
),
]
app_name
=
"bookshelf"
\ No newline at end of file
gabgeraldo_reading/bookshelf/views.py
View file @
e9e9be93
...
...
@@ -34,7 +34,6 @@ class BooksUpdateView(UpdateView):
fields
=
"__all__"
template_name
=
"bookshelf/edit-book.html"
class
AuthorListView
(
ListView
):
model
=
Author
...
...
@@ -44,4 +43,14 @@ class AuthorListView(ListView):
return
ctx
class
AuthorDetailView
(
DetailView
):
model
=
Author
\ No newline at end of file
model
=
Author
class
AuthorCreateView
(
CreateView
):
model
=
Author
fields
=
"__all__"
template_name
=
"bookshelf/add-author.html"
class
AuthorUpdateView
(
UpdateView
):
model
=
Author
fields
=
"__all__"
template_name
=
"bookshelf/edit-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