Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
luigirodriguez_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
Neal Luigi D. Rodriguez
luigirodriguez_reading
Commits
6ad7e15b
Commit
6ad7e15b
authored
Apr 27, 2023
by
Neal Luigi D. Rodriguez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Buttons now properly linked to Edit HTML files
parent
f434234e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
7 additions
and
17 deletions
+7
-17
models.cpython-39.pyc
...iguez_reading/bookshelf/__pycache__/models.cpython-39.pyc
+0
-0
views.cpython-39.pyc
...riguez_reading/bookshelf/__pycache__/views.cpython-39.pyc
+0
-0
models.py
luigirodriguez_reading/bookshelf/models.py
+0
-3
authors_details.html
...eading/bookshelf/templates/bookshelf/authors_details.html
+4
-3
book_details.html
...z_reading/bookshelf/templates/bookshelf/book_details.html
+1
-0
views.py
luigirodriguez_reading/bookshelf/views.py
+2
-11
db.sqlite3
luigirodriguez_reading/db.sqlite3
+0
-0
No files found.
luigirodriguez_reading/bookshelf/__pycache__/models.cpython-39.pyc
View file @
6ad7e15b
No preview for this file type
luigirodriguez_reading/bookshelf/__pycache__/views.cpython-39.pyc
View file @
6ad7e15b
No preview for this file type
luigirodriguez_reading/bookshelf/models.py
View file @
6ad7e15b
...
...
@@ -15,9 +15,6 @@ class Author(models.Model):
def
get_absolute_url
(
self
):
return
reverse
(
'bookshelf:authors-detail'
,
kwargs
=
{
'pk'
:
self
.
pk
})
def
get_edit_url
(
self
):
return
reverse
(
'bookshelf:authors-edit'
,
kwargs
=
{
'pk'
:
self
.
pk
})
class
Books
(
models
.
Model
):
title
=
models
.
CharField
(
max_length
=
1000
)
author
=
models
.
ForeignKey
(
...
...
luigirodriguez_reading/bookshelf/templates/bookshelf/authors_details.html
View file @
6ad7e15b
{% extends 'base.html' %}
{% load static %}
{% block title %} {{ author.first_name }}{% endblock %}
{% block title %} {{ author.first_name }}
{{ author.last_name }}
{% endblock %}
{% block content %}
<link
rel=
"stylesheet"
href=
"{% static 'details_style.css' %}"
>
<link
rel=
"stylesheet"
href=
"{% static 'details_style.css' %}"
>
<h1>
{{ author.first_name }} {{author.last_name}}
</h1>
<ul>
<li>
Age: {{ author.age }}
</li>
...
...
@@ -12,9 +12,10 @@
<li>
{{ author.bio }}
</li>
</div>
</ul>
<button
onclick=
"window.location.href='../../../authors/{{author.id}}/edit/';"
>
Edit Author
</button><br/>
<p>
<a
href=
"http://127.0.0.1:8000/bookshelf/home"
>
Home
</a>
<a
href=
"http://127.0.0.1:8000/bookshelf/books"
>
Books
</a>
<a
href=
"http://127.0.0.1:8000/bookshelf/authors"
>
Authors
</a>
</p>
{% endblock %}
\ No newline at end of file
{% endblock %}
\ No newline at end of file
luigirodriguez_reading/bookshelf/templates/bookshelf/book_details.html
View file @
6ad7e15b
...
...
@@ -14,6 +14,7 @@
<li>
{{ object.blurb }}
</li>
</div>
</ul>
<button
onclick=
"window.location.href='../../../books/{{object.id}}/edit/';"
>
Edit Book
</button><br/>
<p>
<a
href=
"http://127.0.0.1:8000/bookshelf/home"
>
Home
</a>
<a
href=
"http://127.0.0.1:8000/bookshelf/books"
>
Books
</a>
...
...
luigirodriguez_reading/bookshelf/views.py
View file @
6ad7e15b
...
...
@@ -4,8 +4,7 @@ from django.views.generic.list import ListView
from
django.views.generic.detail
import
DetailView
from
django.views.generic.edit
import
CreateView
,
UpdateView
from
django.http
import
HttpResponse
from
django.shortcuts
import
render
,
redirect
,
get_object_or_404
from
django.urls
import
reverse_lazy
from
django.shortcuts
import
render
,
redirect
from
.models
import
Author
,
Books
from
.forms
import
AuthorForm
,
BookForm
...
...
@@ -56,13 +55,6 @@ class BooksUpdateView(UpdateView):
fields
=
'__all__'
template_name
=
'bookshelf/edit-book.html'
def
edit_author
(
request
,
id
):
author
=
get_object_or_404
(
Author
,
id
=
id
)
if
request
.
method
==
'GET'
:
return
render
(
request
,
'bookshelf/edit-author.html'
,
{
'form'
:
AuthorForm
(
instance
=
author
),
'id'
:
id
})
'''
def
author_view
(
request
):
if
request
.
method
==
'POST'
:
form
=
AuthorForm
(
request
.
POST
)
...
...
@@ -81,5 +73,4 @@ def book_view(request):
return
redirect
(
AuthorsDetailView
,
pk
=
new_author
.
pk
)
else
:
form
=
AuthorForm
()
return render(request, 'edit-book.html', {'form': form})
'''
\ No newline at end of file
return
render
(
request
,
'edit-book.html'
,
{
'form'
:
form
})
\ No newline at end of file
luigirodriguez_reading/db.sqlite3
View file @
6ad7e15b
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