Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
library-app-django
Project
Project
Details
Activity
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
Ilham Maulana
library-app-django
Commits
2ec98359
Commit
2ec98359
authored
Jul 04, 2024
by
impfundev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: refactor book form
parent
90f0d56e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
28 deletions
+27
-28
forms.py
books/forms.py
+27
-28
No files found.
books/forms.py
View file @
2ec98359
from
django
import
forms
from
django
import
forms
from
books.models
import
Book
class
BookForm
(
forms
.
Form
):
class
BookForm
(
forms
.
ModelForm
):
title
=
forms
.
CharField
(
class
Meta
:
max_length
=
100
,
model
=
Book
widget
=
forms
.
TextInput
(
fields
=
[
"title"
,
"stock"
,
"description"
]
widgets
=
{
"title"
:
forms
.
TextInput
(
attrs
=
{
attrs
=
{
"placeholder"
:
"Title"
,
"placeholder"
:
"Title"
,
"class"
:
"form-control"
,
"class"
:
"form-control"
,
}
}
),
),
)
"stock"
:
forms
.
TextInput
(
stock
=
forms
.
IntegerField
(
widget
=
forms
.
TextInput
(
attrs
=
{
attrs
=
{
"type"
:
"number"
,
"type"
:
"number"
,
"placeholder"
:
"Stock"
,
"placeholder"
:
"Stock"
,
"class"
:
"form-control"
,
"class"
:
"form-control"
,
}
}
),
),
)
"description"
:
forms
.
Textarea
(
description
=
forms
.
CharField
(
max_length
=
255
,
widget
=
forms
.
Textarea
(
attrs
=
{
attrs
=
{
"placeholder"
:
"Description"
,
"placeholder"
:
"Description"
,
"class"
:
"form-control"
,
"class"
:
"form-control"
,
}
}
),
),
)
}
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