Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
ronrodillas_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
Ron Rodillas
ronrodillas_reading
Commits
fb4b63f6
Commit
fb4b63f6
authored
May 01, 2023
by
Ron Rodillas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
created the add book and author pages
parent
430435c2
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
58 additions
and
3 deletions
+58
-3
urls.cpython-39.pyc
...odillas_reading/bookshelf/__pycache__/urls.cpython-39.pyc
+0
-0
views.cpython-39.pyc
...dillas_reading/bookshelf/__pycache__/views.cpython-39.pyc
+0
-0
add-author.html
...las_reading/bookshelf/templates/bookshelf/add-author.html
+19
-0
add-book.html
...illas_reading/bookshelf/templates/bookshelf/add-book.html
+19
-0
home.html
ronrodillas_reading/bookshelf/templates/bookshelf/home.html
+4
-0
urls.py
ronrodillas_reading/bookshelf/urls.py
+4
-2
views.py
ronrodillas_reading/bookshelf/views.py
+12
-1
db.sqlite3
ronrodillas_reading/db.sqlite3
+0
-0
No files found.
ronrodillas_reading/bookshelf/__pycache__/urls.cpython-39.pyc
View file @
fb4b63f6
No preview for this file type
ronrodillas_reading/bookshelf/__pycache__/views.cpython-39.pyc
View file @
fb4b63f6
No preview for this file type
ronrodillas_reading/bookshelf/templates/bookshelf/add-author.html
0 → 100644
View file @
fb4b63f6
{% extends 'base.html' %}
{% load static %}
{% block title %}
Add New Author
{% endblock %}
{% block styles %}
{% endblock %}
{% block content %}
<form
method=
"POST"
enctype=
"multipart/form-data"
>
{% csrf_token %}
{{ form.as_p }}
<input
type=
"submit"
value=
"Add Author"
>
</form>
{% endblock %}
\ No newline at end of file
ronrodillas_reading/bookshelf/templates/bookshelf/add-book.html
0 → 100644
View file @
fb4b63f6
{% extends 'base.html' %}
{% load static %}
{% block title %}
Add New Book
{% endblock %}
{% block styles %}
{% endblock %}
{% block content %}
<form
method=
"POST"
enctype=
"multipart/form-data"
>
{% csrf_token %}
{{ form.as_p }}
<input
type=
"submit"
value=
"Add Book"
>
</form>
{% endblock %}
\ No newline at end of file
ronrodillas_reading/bookshelf/templates/bookshelf/home.html
View file @
fb4b63f6
...
@@ -33,5 +33,9 @@ div {
...
@@ -33,5 +33,9 @@ div {
<a
href=
"{% url 'bookshelf:BooksView' %}"
>
Books
</a>
<a
href=
"{% url 'bookshelf:BooksView' %}"
>
Books
</a>
<a
href=
"{% url 'bookshelf:AuthorsView' %}"
>
Authors
</a>
<a
href=
"{% url 'bookshelf:AuthorsView' %}"
>
Authors
</a>
<br>
<a
href=
"{% url 'bookshelf:AddBook' %}"
>
Add Book
</a>
<a
href=
"{% url 'bookshelf:AddAuthor' %}"
>
Add Author
</a>
</div>
</div>
{% endblock %}
{% endblock %}
\ No newline at end of file
ronrodillas_reading/bookshelf/urls.py
View file @
fb4b63f6
from
django.urls
import
path
from
django.urls
import
path
from
.views
import
home
,
BooksView
,
AuthorsView
,
BookDetailView
,
AuthorDetailView
from
.views
import
*
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
home
,
name
=
'home'
),
path
(
''
,
home
,
name
=
'home'
),
path
(
'books/'
,
BooksView
.
as_view
(),
name
=
'BooksView'
),
path
(
'books/'
,
BooksView
.
as_view
(),
name
=
'BooksView'
),
path
(
'authors/'
,
AuthorsView
.
as_view
(),
name
=
'AuthorsView'
),
path
(
'authors/'
,
AuthorsView
.
as_view
(),
name
=
'AuthorsView'
),
path
(
'books/<int:pk>/details'
,
BookDetailView
.
as_view
(),
name
=
'BookDetailView'
),
path
(
'books/<int:pk>/details'
,
BookDetailView
.
as_view
(),
name
=
'BookDetailView'
),
path
(
'authors/<int:pk>/details'
,
AuthorDetailView
.
as_view
(),
name
=
'AuthorDetailView'
)
path
(
'authors/<int:pk>/details'
,
AuthorDetailView
.
as_view
(),
name
=
'AuthorDetailView'
),
path
(
'books/add'
,
BooksCreateView
.
as_view
(),
name
=
'AddBook'
),
path
(
'authors/add/'
,
AuthorCreateView
.
as_view
(),
name
=
'AddAuthor'
),
]
]
app_name
=
"bookshelf"
app_name
=
"bookshelf"
\ No newline at end of file
ronrodillas_reading/bookshelf/views.py
View file @
fb4b63f6
...
@@ -2,7 +2,9 @@ from django.shortcuts import render
...
@@ -2,7 +2,9 @@ from django.shortcuts import render
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
django.views
import
View
from
django.views
import
View
from
django.views.generic.detail
import
DetailView
from
django.views.generic.detail
import
DetailView
from
django.views.generic.edit
import
CreateView
,
UpdateView
from
.models
import
*
from
.models
import
*
# Create your views here.
# Create your views here.
def
home
(
request
):
def
home
(
request
):
return
render
(
request
,
"bookshelf/home.html"
)
return
render
(
request
,
"bookshelf/home.html"
)
...
@@ -23,3 +25,12 @@ class BookDetailView(DetailView):
...
@@ -23,3 +25,12 @@ class BookDetailView(DetailView):
class
AuthorDetailView
(
DetailView
):
class
AuthorDetailView
(
DetailView
):
model
=
Author
model
=
Author
class
BooksCreateView
(
CreateView
):
model
=
Books
fields
=
'__all__'
template_name
=
'bookshelf/add-book.html'
class
AuthorCreateView
(
CreateView
):
model
=
Author
fields
=
'__all__'
template_name
=
'bookshelf/add-author.html'
\ No newline at end of file
ronrodillas_reading/db.sqlite3
View file @
fb4b63f6
No preview for this file type
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