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