Fakultas Ilmu Komputer UI

Commit 16ca5541 authored by igor lestin sianipar's avatar igor lestin sianipar Committed by I Gusti Putu Agastya Indrayana
Browse files

Pbi 3 unggah materi

parent 537bac93
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 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():
......@@ -29,15 +37,19 @@ class Comment(models.Model):
class Materi(models.Model):
#TODO: file fields, cover ubah jadi image fields, uploader jadi one to one kontributor
cover = models.URLField(max_length=1000)
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
# 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, null=True)
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='')
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