Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
janang_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
Jan Ericsson Ong Ang
janang_reading
Commits
a2727c82
Commit
a2727c82
authored
Apr 25, 2023
by
Jan Ericsson Ong Ang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated forms.py
parent
a0c246cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
15 deletions
+9
-15
forms.py
janang_reading/bookshelf/forms.py
+9
-15
No files found.
janang_reading/bookshelf/forms.py
View file @
a2727c82
from
django
import
forms
from
django.db
import
models
from
models
import
Author
from
.models
import
Books
,
Author
class
AuthorForm
(
forms
.
Form
):
first_name
=
forms
.
CharField
(
label
=
'first_name'
,
max_length
=
50
)
last_name
=
forms
.
CharField
(
label
=
'last_name'
,
max_length
=
50
)
age
=
forms
.
IntegerField
(
label
=
'age'
)
nationality
=
forms
.
CharField
(
label
=
'nationality'
,
max_length
=
50
)
bio
=
forms
.
TextField
(
label
=
'bio'
,
max_length
=
700
)
class
AuthorForm
(
forms
.
ModelForm
):
class
Meta
:
model
=
Author
fields
=
"__all__"
class
BookForm
(
forms
.
Form
):
title
=
forms
.
CharField
(
label
=
'title'
,
max_length
=
50
)
author
=
forms
.
ForeignKey
(
Author
,
on_delete
=
models
.
CASCADE
)
publisher
=
forms
.
CharField
(
label
=
'publisher'
,
max_length
=
50
)
year_published
=
forms
.
IntegerField
(
label
=
'year_published'
,
max_length
=
50
)
ISBN
=
forms
.
CharField
(
label
=
'ISBN'
,
max_length
=
50
)
blurb
=
forms
.
CharField
(
label
=
'blurb'
,
max_length
=
50
)
\ No newline at end of file
class
BookForm
(
forms
.
ModelForm
):
class
Meta
:
model
=
Books
fields
=
"__all__"
\ 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