|
|
@ -3,6 +3,7 @@ |
|
|
|
from __future__ import unicode_literals |
|
|
|
from django.db import models |
|
|
|
|
|
|
|
|
|
|
|
class CourseStats(models.Model): |
|
|
|
# databaseview: (postgresql dialect): |
|
|
|
# -- View: sigi_course_stats |
|
|
@ -51,6 +52,7 @@ class CourseStats(models.Model): |
|
|
|
def __unicode__(self): |
|
|
|
return '%s - %s: %s' % (self.category.name, self.course.fullname, self.usercount) |
|
|
|
|
|
|
|
|
|
|
|
class Cohort(models.Model): |
|
|
|
id = models.BigIntegerField(primary_key=True) |
|
|
|
context = models.ForeignKey('Context', db_column='contextid') |
|
|
@ -72,6 +74,7 @@ class Cohort(models.Model): |
|
|
|
def __unicode__(self): |
|
|
|
return self.name |
|
|
|
|
|
|
|
|
|
|
|
class CohortMembers(models.Model): |
|
|
|
id = models.BigIntegerField(primary_key=True) |
|
|
|
cohort = models.ForeignKey('Cohort', db_column='cohortid') |
|
|
@ -82,6 +85,7 @@ class CohortMembers(models.Model): |
|
|
|
managed = False |
|
|
|
db_table = 'mdl_cohort_members' |
|
|
|
|
|
|
|
|
|
|
|
class Context(models.Model): |
|
|
|
CONTEXT_SYSTEM = 10 # System context level - only one instance in every system |
|
|
|
CONTEXT_USER = 30 # User context level - one instance for each user describing what others can do to user |
|
|
@ -105,6 +109,7 @@ class Context(models.Model): |
|
|
|
def __unicode__(self): |
|
|
|
return self.path |
|
|
|
|
|
|
|
|
|
|
|
class Course(models.Model): |
|
|
|
id = models.BigIntegerField(primary_key=True) |
|
|
|
category = models.ForeignKey('CourseCategories', db_column='category', related_name='courses') |
|
|
@ -158,6 +163,7 @@ class Course(models.Model): |
|
|
|
q = q | e.user_enrolments.all() |
|
|
|
return q |
|
|
|
|
|
|
|
|
|
|
|
class CourseCategories(models.Model): |
|
|
|
id = models.BigIntegerField(primary_key=True) |
|
|
|
name = models.CharField(max_length=255) |
|
|
@ -212,6 +218,7 @@ class CourseCategories(models.Model): |
|
|
|
q = q | c.get_all_courses(only_visible=only_visible) |
|
|
|
return q |
|
|
|
|
|
|
|
|
|
|
|
class CourseCompletions(models.Model): |
|
|
|
id = models.BigIntegerField(primary_key=True) |
|
|
|
user = models.ForeignKey('User', db_column='userid') |
|
|
@ -225,6 +232,7 @@ class CourseCompletions(models.Model): |
|
|
|
managed = False |
|
|
|
db_table = 'mdl_course_completions' |
|
|
|
|
|
|
|
|
|
|
|
class Enrol(models.Model): |
|
|
|
id = models.BigIntegerField(primary_key=True) |
|
|
|
enrol = models.CharField(max_length=20) |
|
|
@ -272,6 +280,7 @@ class Enrol(models.Model): |
|
|
|
return self.enrol |
|
|
|
return self.name |
|
|
|
|
|
|
|
|
|
|
|
class User(models.Model): |
|
|
|
id = models.BigIntegerField(primary_key=True) |
|
|
|
auth = models.CharField(max_length=20) |
|
|
|