From 886ad73415f99480bbe87b0ffd82f54222d7c5b9 Mon Sep 17 00:00:00 2001 From: fbormann Date: Fri, 16 Sep 2016 01:33:03 -0300 Subject: [PATCH] improved models to build the topic page #50 --- core/models.py | 2 +- courses/models.py | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/core/models.py b/core/models.py index dae16ac..698a256 100644 --- a/core/models.py +++ b/core/models.py @@ -34,7 +34,7 @@ class Resource(models.Model): name = models.CharField(_('Name'), max_length =100, unique=True) created_date = models.DateField(_('Created Date'), auto_now_add=True) - link = models.CharField(_('URL'), max_length =100, default="") + url = models.CharField(_('URL'), max_length =100, default="") class Meta: diff --git a/courses/models.py b/courses/models.py index c979710..3eddf15 100644 --- a/courses/models.py +++ b/courses/models.py @@ -2,6 +2,7 @@ from django.utils.translation import ugettext_lazy as _ from django.db import models from autoslug.fields import AutoSlugField from users.models import User +from core.models import Resource class Category(models.Model): @@ -70,6 +71,7 @@ class Topic(models.Model): update_date = models.DateTimeField(_('Date of last update'), auto_now=True) subject = models.ForeignKey(Subject, verbose_name = _('Subject'), related_name="topics") owner = models.ForeignKey(User, verbose_name = _('Owner'), related_name="topics") + visible = models.BooleanField(_('Visible'), default=False) class Meta: ordering = ('create_date','name') @@ -78,3 +80,21 @@ class Topic(models.Model): def __str__(self): return self.name + +""" +It is one kind of possible resources available inside a Topic. +Activity is something that has a deadline and has to be delivered by the student +""" +class Activity(Resource): + create_date = models.DateTimeField(_('Creation Date'), auto_now_add = True) + topic = models.ForeignKey(Topic, verbose_name = _('Topic'), related_name="topic") + create_date = models.DateTimeField(_('Creation Date'), auto_now_add = True) + limit_date = models.DateTimeField(_('Deliver Date')) + student = models.ForeignKey(User, verbose_name = _('student'), related_name="student") + grade = models.IntegerField(_('grade')) + +""" +It is one kind of possible resources available inside a Topic. +""" +class Link(Resource): + url_field = models.CharField(_('url'), max_length= 300) \ No newline at end of file -- libgit2 0.21.2