Fakultas Ilmu Komputer UI

Commit 56a83138 authored by Putu Agastya's avatar Putu Agastya
Browse files

[CHORES] Pull latest code from stagging.

parents 61f28b38 e7e2dae8
from django import forms
from app.models import Materi
class UploadMateriForm(forms.ModelForm):
class Meta:
model = Materi
fields = ['title', 'author', 'publisher',
'categories', 'descriptions', 'cover', 'content']
def __init__(self, *args, **kwargs):
super(UploadMateriForm, self).__init__(*args, **kwargs)
for field_name, field in self.fields.items():
field.widget.attrs['class'] = 'form-control'
# Generated by Django 3.0.3 on 2020-04-22 15:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0007_auto_20200421_2151'),
]
operations = [
migrations.AlterField(
model_name='comment',
name='profile',
field=models.CharField(default='d91905', max_length=100),
),
migrations.AlterField(
model_name='comment',
name='user',
field=models.CharField(default='2565edd4bdac454d9cd87e2e7d93d27f', max_length=100),
),
]
# Generated by Django 3.0.3 on 2020-04-22 15:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0008_auto_20200422_2202'),
]
operations = [
migrations.AlterField(
model_name='comment',
name='profile',
field=models.CharField(default='cbacb3', max_length=100),
),
migrations.AlterField(
model_name='comment',
name='user',
field=models.CharField(default='31d4991724a9498fb58b631db4636bff', max_length=100),
),
migrations.AlterField(
model_name='materi',
name='verified',
field=models.BooleanField(default=False, null=True),
),
]
# Generated by Django 3.0.3 on 2020-04-22 15:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0009_auto_20200422_2206'),
]
operations = [
migrations.AlterField(
model_name='comment',
name='profile',
field=models.CharField(default='e2db20', max_length=100),
),
migrations.AlterField(
model_name='comment',
name='user',
field=models.CharField(default='e230956660bd4b899b4b81f03e6553a6', max_length=100),
),
]
# Generated by Django 3.0.3 on 2020-04-22 20:55
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('app', '0010_auto_20200422_2206'),
]
operations = [
migrations.RemoveField(
model_name='materi',
name='verified',
),
migrations.AddField(
model_name='materi',
name='content',
field=models.FileField(default='', upload_to=''),
preserve_default=False,
),
migrations.AddField(
model_name='materi',
name='feedback',
field=models.TextField(blank=True, default=''),
),
migrations.AddField(
model_name='materi',
name='status',
field=models.CharField(choices=[('PENDING', 'Diproses'), ('APPROVE', 'Diterima'), ('DISAPROVE', 'Ditolak'), ('REVISION', 'Perbaikan')], default=('PENDING', 'Diproses'), max_length=30),
),
migrations.AlterField(
model_name='comment',
name='profile',
field=models.CharField(default='3990fb', max_length=100),
),
migrations.AlterField(
model_name='comment',
name='user',
field=models.CharField(default='93d81d288ee648b38fedd1d07f506aeb', max_length=100),
),
migrations.AlterField(
model_name='materi',
name='cover',
field=models.ImageField(upload_to=''),
),
migrations.AlterField(
model_name='materi',
name='uploader',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL),
),
]
# Generated by Django 3.0.3 on 2020-04-23 03:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0011_auto_20200423_0355'),
]
operations = [
migrations.AlterField(
model_name='comment',
name='profile',
field=models.CharField(default='b107be', max_length=100),
),
migrations.AlterField(
model_name='comment',
name='user',
field=models.CharField(default='28e90a8599bf4ebdacd5e131fae4c1d0', max_length=100),
),
]
from django.db import models
import uuid
import random
from authentication.models import User
VERIFICATION_STATUS = [
('PENDING', 'Diproses'),
('APPROVE', 'Diterima'),
('DISAPROVE', 'Ditolak'),
('REVISION', 'Perbaikan'),
]
# Create your models here.
def getRandomColor():
color = "%06x" % random.randint(0, 0xFFFFFF)
return color
return color
def getRandomUserId():
userId = uuid.uuid4().hex
return userId
class Category(models.Model):
name = models.CharField(max_length=20)
description = models.CharField(max_length=20)
......@@ -20,20 +32,27 @@ class Category(models.Model):
class Comment(models.Model):
user = models.CharField(max_length = 100, default= getRandomUserId())
profile = models.CharField(max_length = 100, default= getRandomColor())
comment = models.CharField(max_length = 150, default= 'comments')
user = models.CharField(max_length=100, default=getRandomUserId())
profile = models.CharField(max_length=100, default=getRandomColor())
comment = models.CharField(max_length=150, default='comments')
def __str__(self):
return self.user
class Materi(models.Model):
cover = models.URLField(max_length=1000)
title = models.CharField(max_length=50, default='title')
# TODO: file fields, cover ubah jadi image fields, uploader jadi one to one kontributor
cover = models.ImageField()
content = models.FileField()
title = models.CharField(max_length=50, default='title')
author = models.CharField(max_length=30, default='author')
uploader = models.CharField(max_length=30, default='uploader')
# ubah jadi one to one ke kontributor
uploader = models.ForeignKey(User, on_delete=models.SET_NULL, null=True)
publisher = models.CharField(max_length=30, default='publiser')
descriptions = models.TextField(default='descriptions')
verified = models.BooleanField(default=False)
status = models.CharField(
max_length=30, choices=VERIFICATION_STATUS, default=VERIFICATION_STATUS[0])
categories = models.ManyToManyField(Category)
comments = models.ManyToManyField(Comment)
feedback = models.TextField(blank=True, default='')
body{
font-family: 'Poppins', sans-serif;
}
.container{
margin-top: 20px;
}
.row{}
.materi-data{
padding: 20px;
border-bottom: 1px solid #d4d4d4
}
.cover{
max-width: 300px;
}
.category-wrapper{
display: flex;
flex-direction: row;
}
.cover img{
width: 100%;
}
.book p, h2 {
margin: 0
}
.info-wrapper{
margin-top: 20px;
}
.info{
margin: 10px 0;
border-bottom: 1px solid #d4d4d4;
display: flex;
flex-direction: row;
}
.info .col{
padding: 0;
}
.btn-book {
background-color: #ffffff;
color: #5B84B1;
}
.btn-book:hover {
color: #5B84B1;
}
.menu-wrapper{
display: flex;
flex-direction: column;
}
.menu-wrapper .col{
padding: 0;
}
.menu-wrapper .navbar {
padding: 0;
border-bottom: 1px solid #d4d4d4;
margin-bottom: 10px;
}
.menu-wrapper .nav-link {
color: #bbbbbb;
}
.nav-item :hover{
color: #5B84B1;
}
.menu-wrapper .nav-item{
padding: 5px 0;
}
.description-wrapper{
border-bottom: 1px solid #d4d4d4;
margin-bottom: 10px;
}
.comment{
border-bottom: 1px solid #d4d4d4;
}
.comment .user {
display: flex;
flex-direction: row;
margin-bottom: 10px;
}
.comment .user p{
margin: 0
}
.comment .user .profile{
height: 25px;
width: 25px;
background-color: #bbb;
border-radius: 50%;
display: inline-block;
margin-right: 10px;
}
.comment .text{
padding-left: 20px;
}
\ No newline at end of file
This diff is collapsed.
.media {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: start;
-ms-flex-align: start;
align-items: flex-start; }
.media-body {
-webkit-box-flex: 1;
-ms-flex: 1;
flex: 1; }
.stretched-link::after {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1;
pointer-events: auto;
content: "";
background-color: rgba(0, 0, 0, 0); }
h1 {
font-size: 20px;
margin-top: 24px;
margin-bottom: 24px;
}
\ No newline at end of file
This diff is collapsed.
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