Fakultas Ilmu Komputer UI

Commit a4735e4f authored by Mika dabelza abi's avatar Mika dabelza abi Committed by Samuel Dimas Partogi
Browse files

Coldfix pbi 3 unggah materi restriksi

parent cef3365b
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):
......
......@@ -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">
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment