Fakultas Ilmu Komputer UI
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
PMPL
Class Project
DIGIPUS
Commits
a4735e4f
Commit
a4735e4f
authored
Jun 04, 2020
by
Mika dabelza abi
Committed by
Samuel Dimas Partogi
Jun 04, 2020
Browse files
Coldfix pbi 3 unggah materi restriksi
parent
cef3365b
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/forms.py
View file @
a4735e4f
from
django
import
forms
from
app.models
import
Materi
from
app.models
import
Materi
,
Category
from
authentication.models
import
User
class
UploadMateriForm
(
forms
.
ModelForm
):
categories
=
forms
.
ModelMultipleChoiceField
(
queryset
=
Category
.
objects
.
all
(),
widget
=
forms
.
CheckboxSelectMultiple
(
attrs
=
{
'style'
:
'column-count:2'
}),
required
=
True
)
#categories.widget.attrs["style"] = "column-count:2"
class
Meta
:
model
=
Materi
fields
=
[
"title"
,
"author"
,
"publisher"
,
...
...
@@ -13,7 +17,11 @@ class UploadMateriForm(forms.ModelForm):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
UploadMateriForm
,
self
).
__init__
(
*
args
,
**
kwargs
)
for
field_name
,
field
in
self
.
fields
.
items
():
if
(
field_name
==
"categories"
):
continue
field
.
widget
.
attrs
[
"class"
]
=
"form-control"
self
.
fields
[
'categories'
].
widget
.
attrs
.
update
({
'class'
:
"native"
})
class
SuntingProfilForm
(
forms
.
ModelForm
):
...
...
app/templates/unggah.html
View file @
a4735e4f
...
...
@@ -3,6 +3,23 @@
<!DOCTYPE html>
<html
lang=
"en"
>
<style>
ul
{
margin
:
0
;
padding
:
0
;}
.native
{
-webkit-column-width
:
200px
;
-moz-column-width
:
200px
;
-o-column-width
:
200px
;
-ms-column-width
:
200px
;
column-width
:
200px
;
-webkit-column-rule-style
:
solid
;
-moz-column-rule-style
:
solid
;
-o-column-rule-style
:
solid
;
-ms-column-rule-style
:
solid
;
column-rule-style
:
solid
;
}
</style>
<head>
<meta
charset=
"utf-8"
>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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