from django.db import models
from django.utils import timezone

# Course Category
class Course_category(models.Model):
    category_id = models.AutoField(primary_key=True)
    category_name = models.CharField(max_length=100)
    date_of_creation = models.DateTimeField(default=timezone.now)
 
# Course Subcategory
class Course_subcategory(models.Model):
    subcategory_id = models.AutoField(primary_key=True)
    category = models.ForeignKey(Course_category, on_delete=models.CASCADE)
    subcategory_name = models.CharField(max_length=100)
    date_of_creation = models.DateTimeField(default=timezone.now)

# Course
class Course(models.Model):
    course_id = models.AutoField(primary_key=True)
    subcategory = models.ForeignKey(Course_subcategory, on_delete=models.CASCADE)
    subcategory_name = models.CharField(max_length=100)
    category_name = models.CharField(max_length=100)
    course_name = models.CharField(max_length=100)
    date_of_creation = models.DateTimeField(default=timezone.now)
    course_description = models.TextField(default="")
    course_difficulty = models.CharField(max_length=30)

# Course resources
class Course_resource(models.Model):
    course = models.ForeignKey(Course, on_delete=models.CASCADE)
    resourse_content = models.TextField(default="NIL")
    resourse_name = models.CharField(max_length=100)
    resourse_link = models.CharField(max_length=200)
    resourse_length = models.CharField(max_length=10)
    date_of_creation = models.DateTimeField(default=timezone.now)

[(6, 'django.db.models.AutoField', 'models.AutoField', ([], {'primary_key': '(True)'}), False, 'from django.db import models\n'), (7, 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), False, 'from django.db import models\n'), (8, 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'default': 'timezone.now'}), False, 'from django.db import models\n'), (12, 'django.db.models.AutoField', 'models.AutoField', ([], {'primary_key': '(True)'}), False, 'from django.db import models\n'), (13, 'django.db.models.ForeignKey', 'models.ForeignKey', (['Course_category'], {'on_delete': 'models.CASCADE'}), False, 'from django.db import models\n'), (14, 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), False, 'from django.db import models\n'), (15, 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'default': 'timezone.now'}), False, 'from django.db import models\n'), (19, 'django.db.models.AutoField', 'models.AutoField', ([], {'primary_key': '(True)'}), False, 'from django.db import models\n'), (20, 'django.db.models.ForeignKey', 'models.ForeignKey', (['Course_subcategory'], {'on_delete': 'models.CASCADE'}), False, 'from django.db import models\n'), (21, 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), False, 'from django.db import models\n'), (22, 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), False, 'from django.db import models\n'), (23, 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), False, 'from django.db import models\n'), (24, 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'default': 'timezone.now'}), False, 'from django.db import models\n'), (25, 'django.db.models.TextField', 'models.TextField', ([], {'default': '""""""'}), False, 'from django.db import models\n'), (26, 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(30)'}), False, 'from django.db import models\n'), (30, 'django.db.models.ForeignKey', 'models.ForeignKey', (['Course'], {'on_delete': 'models.CASCADE'}), False, 'from django.db import models\n'), (31, 'django.db.models.TextField', 'models.TextField', ([], {'default': '"""NIL"""'}), False, 'from django.db import models\n'), (32, 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), False, 'from django.db import models\n'), (33, 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)'}), False, 'from django.db import models\n'), (34, 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(10)'}), False, 'from django.db import models\n'), (35, 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'default': 'timezone.now'}), False, 'from django.db import models\n')]