Fakultas Ilmu Komputer UI

models.py 704 Bytes
Newer Older
Samuel Dimas's avatar
Samuel Dimas committed
1
2
3
from django.db import models

# Create your models here.
4
5
6
7
8
9
10
class Category(models.Model):
    name = models.CharField(max_length=20)
    description = models.CharField(max_length=20)

    def __str__(self):
        return self.name

11
12
class Materi(models.Model):
    cover = models.URLField(max_length=1000)
13
14
15
16
17
18
    title = models.CharField(max_length=50, default='SOME STRING') 
    author = models.CharField(max_length=30, default='SOME STRING')
    uploader = models.CharField(max_length=30, default='SOME STRING')
    publisher = models.CharField(max_length=30, default='SOME STRING')
    descriptions = models.CharField(max_length=300, default='SOME STRING')
    categories = models.ManyToManyField(Category)