Commit 886ad73415f99480bbe87b0ffd82f54222d7c5b9
1 parent
fbc7566a
Exists in
master
and in
5 other branches
improved models to build the topic page #50
Showing
2 changed files
with
21 additions
and
1 deletions
Show diff stats
core/models.py
@@ -34,7 +34,7 @@ class Resource(models.Model): | @@ -34,7 +34,7 @@ class Resource(models.Model): | ||
34 | 34 | ||
35 | name = models.CharField(_('Name'), max_length =100, unique=True) | 35 | name = models.CharField(_('Name'), max_length =100, unique=True) |
36 | created_date = models.DateField(_('Created Date'), auto_now_add=True) | 36 | created_date = models.DateField(_('Created Date'), auto_now_add=True) |
37 | - link = models.CharField(_('URL'), max_length =100, default="") | 37 | + url = models.CharField(_('URL'), max_length =100, default="") |
38 | 38 | ||
39 | 39 | ||
40 | class Meta: | 40 | class Meta: |
courses/models.py
@@ -2,6 +2,7 @@ from django.utils.translation import ugettext_lazy as _ | @@ -2,6 +2,7 @@ from django.utils.translation import ugettext_lazy as _ | ||
2 | from django.db import models | 2 | from django.db import models |
3 | from autoslug.fields import AutoSlugField | 3 | from autoslug.fields import AutoSlugField |
4 | from users.models import User | 4 | from users.models import User |
5 | +from core.models import Resource | ||
5 | 6 | ||
6 | class Category(models.Model): | 7 | class Category(models.Model): |
7 | 8 | ||
@@ -70,6 +71,7 @@ class Topic(models.Model): | @@ -70,6 +71,7 @@ class Topic(models.Model): | ||
70 | update_date = models.DateTimeField(_('Date of last update'), auto_now=True) | 71 | update_date = models.DateTimeField(_('Date of last update'), auto_now=True) |
71 | subject = models.ForeignKey(Subject, verbose_name = _('Subject'), related_name="topics") | 72 | subject = models.ForeignKey(Subject, verbose_name = _('Subject'), related_name="topics") |
72 | owner = models.ForeignKey(User, verbose_name = _('Owner'), related_name="topics") | 73 | owner = models.ForeignKey(User, verbose_name = _('Owner'), related_name="topics") |
74 | + visible = models.BooleanField(_('Visible'), default=False) | ||
73 | 75 | ||
74 | class Meta: | 76 | class Meta: |
75 | ordering = ('create_date','name') | 77 | ordering = ('create_date','name') |
@@ -78,3 +80,21 @@ class Topic(models.Model): | @@ -78,3 +80,21 @@ class Topic(models.Model): | ||
78 | 80 | ||
79 | def __str__(self): | 81 | def __str__(self): |
80 | return self.name | 82 | return self.name |
83 | + | ||
84 | +""" | ||
85 | +It is one kind of possible resources available inside a Topic. | ||
86 | +Activity is something that has a deadline and has to be delivered by the student | ||
87 | +""" | ||
88 | +class Activity(Resource): | ||
89 | + create_date = models.DateTimeField(_('Creation Date'), auto_now_add = True) | ||
90 | + topic = models.ForeignKey(Topic, verbose_name = _('Topic'), related_name="topic") | ||
91 | + create_date = models.DateTimeField(_('Creation Date'), auto_now_add = True) | ||
92 | + limit_date = models.DateTimeField(_('Deliver Date')) | ||
93 | + student = models.ForeignKey(User, verbose_name = _('student'), related_name="student") | ||
94 | + grade = models.IntegerField(_('grade')) | ||
95 | + | ||
96 | +""" | ||
97 | +It is one kind of possible resources available inside a Topic. | ||
98 | +""" | ||
99 | +class Link(Resource): | ||
100 | + url_field = models.CharField(_('url'), max_length= 300) | ||
81 | \ No newline at end of file | 101 | \ No newline at end of file |