Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
alecdayupay_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
Alec Dayupay
alecdayupay_reading
Commits
7ecd500d
Commit
7ecd500d
authored
Apr 25, 2023
by
Alec Dayupay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added get_absolute_url() in models
parent
a1eb2c7b
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
10 additions
and
2 deletions
+10
-2
models.cpython-39.pyc
...yupay_reading/bookshelf/__pycache__/models.cpython-39.pyc
+0
-0
urls.cpython-39.pyc
...dayupay_reading/bookshelf/__pycache__/urls.cpython-39.pyc
+0
-0
views.cpython-39.pyc
...ayupay_reading/bookshelf/__pycache__/views.cpython-39.pyc
+0
-0
models.py
alecdayupay_reading/bookshelf/models.py
+9
-1
edit_author.html
...ay_reading/bookshelf/templates/bookshelf/edit_author.html
+1
-1
db.sqlite3
alecdayupay_reading/db.sqlite3
+0
-0
No files found.
alecdayupay_reading/bookshelf/__pycache__/models.cpython-39.pyc
View file @
7ecd500d
No preview for this file type
alecdayupay_reading/bookshelf/__pycache__/urls.cpython-39.pyc
View file @
7ecd500d
No preview for this file type
alecdayupay_reading/bookshelf/__pycache__/views.cpython-39.pyc
View file @
7ecd500d
No preview for this file type
alecdayupay_reading/bookshelf/models.py
View file @
7ecd500d
from
django.db
import
models
from
django.db
import
models
from
django.urls
import
reverse
# Create your models here.
# Create your models here.
class
Author
(
models
.
Model
):
class
Author
(
models
.
Model
):
...
@@ -11,6 +12,10 @@ class Author(models.Model):
...
@@ -11,6 +12,10 @@ class Author(models.Model):
def
__str__
(
self
):
def
__str__
(
self
):
return
"{} {}"
.
format
(
self
.
first_name
,
self
.
last_name
)
return
"{} {}"
.
format
(
self
.
first_name
,
self
.
last_name
)
def
get_absolute_url
(
self
):
return
reverse
(
"author_details"
,
kwargs
=
{
'pk'
:
self
.
pk
})
class
Books
(
models
.
Model
):
class
Books
(
models
.
Model
):
title
=
models
.
CharField
(
max_length
=
50
)
title
=
models
.
CharField
(
max_length
=
50
)
author
=
models
.
ForeignKey
(
Author
,
on_delete
=
models
.
CASCADE
)
author
=
models
.
ForeignKey
(
Author
,
on_delete
=
models
.
CASCADE
)
...
@@ -18,3 +23,6 @@ class Books(models.Model):
...
@@ -18,3 +23,6 @@ class Books(models.Model):
year_published
=
models
.
IntegerField
(
default
=
0
)
year_published
=
models
.
IntegerField
(
default
=
0
)
ISBN
=
models
.
IntegerField
(
default
=
0
)
ISBN
=
models
.
IntegerField
(
default
=
0
)
blurb
=
models
.
TextField
()
blurb
=
models
.
TextField
()
def
get_absolute_url
(
self
):
return
reverse
(
"book_details"
,
kwargs
=
{
'pk'
:
self
.
pk
})
\ No newline at end of file
alecdayupay_reading/bookshelf/templates/bookshelf/edit_author.html
View file @
7ecd500d
...
@@ -7,6 +7,6 @@
...
@@ -7,6 +7,6 @@
<form
method=
"POST"
>
<form
method=
"POST"
>
{% csrf_token %}
{% csrf_token %}
{{ form.as_p }}
{{ form.as_p }}
<input
type=
"Submit"
value=
"Save Changes"
>
<input
type=
"Submit"
value=
"Save Changes"
/
>
</form>
</form>
{% endblock %}
{% endblock %}
\ No newline at end of file
alecdayupay_reading/db.sqlite3
View file @
7ecd500d
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