Models¶
myapp.models
¶
CommonModel
¶
Bases:
A common abstract :class:django.db.models.Model with common fields for all "real" Models.
Source code in myapp/models.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
id = models.UUIDField(primary_key=True, default=(uuid.uuid4), editable=False, help_text='globally unique id (UUID4)')
class-attribute
instance-attribute
¶
Unique object ID
effective_start_date = models.DateField(default=None, blank=True, null=True, help_text='date when this instance becomes valid')
class-attribute
instance-attribute
¶
Date when this instance becomes valid
effective_end_date = models.DateField(default=None, blank=True, null=True, help_text='date when this instance becomes invalid')
class-attribute
instance-attribute
¶
Date when this instance becomes invalid
last_mod_user_name = models.CharField(default=None, null=True, max_length=80, help_text='who last modified this instance')
class-attribute
instance-attribute
¶
Who last modified this instance
last_mod_date = models.DateField(auto_now=True, help_text='when they modified it')
class-attribute
instance-attribute
¶
Wheno they modified it
Course
¶
Bases:
A course of instruction. e.g. COMSW1002 Computing in Context
Source code in myapp/models.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
school_bulletin_prefix_code = models.CharField(max_length=10)
class-attribute
instance-attribute
¶
School bulletin prefix_code
suffix_two = models.CharField(max_length=2, help_text='two-character identifier suffix')
class-attribute
instance-attribute
¶
Two-character inditifier suffix
subject_area_code = models.CharField(max_length=10, help_text='Subject')
class-attribute
instance-attribute
¶
Subject area code
course_number = models.CharField(max_length=10, help_text='"Shortcut" identifier (formerly for touch-tone registration)')
class-attribute
instance-attribute
¶
course_identifier = models.CharField(max_length=9, unique=True, help_text='Course identifier (one-character suffix)', validators=(validators.RegexValidator(regex='[A-Z]{4}[0-9]{4}[A-Z]'), validators.MinLengthValidator(limit_value=9)))
class-attribute
instance-attribute
¶
course_name = models.CharField(max_length=80, help_text='Course official title')
class-attribute
instance-attribute
¶
course_description = models.TextField(help_text='Course description')
class-attribute
instance-attribute
¶
Meta
¶
Source code in myapp/models.py
76 77 | |
ordering = ['course_number']
class-attribute
instance-attribute
¶
__str__()
¶
Source code in myapp/models.py
79 80 81 82 83 84 85 | |
CourseTerm
¶
Bases:
A specific course term (year+semester) instance. e.g. 20183COMSW1002
Source code in myapp/models.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
term_identifier = models.CharField(max_length=14, unique=True, validators=(validators.RegexValidator(regex='[0-9]{4}[123][A-Z]{4}[0-9]{4}[A-Z]'), validators.MinLengthValidator(limit_value=14)))
class-attribute
instance-attribute
¶
audit_permitted_code = models.PositiveIntegerField(blank=True, default=0)
class-attribute
instance-attribute
¶
exam_credit_flag = models.BooleanField(default=True)
class-attribute
instance-attribute
¶
course = models.ForeignKey('myapp.Course', related_name='course_terms', on_delete=(models.CASCADE), null=True, default=None)
class-attribute
instance-attribute
¶
Meta
¶
Source code in myapp/models.py
112 113 | |
ordering = ['term_identifier']
class-attribute
instance-attribute
¶
__str__()
¶
Source code in myapp/models.py
115 116 117 118 119 120 | |
Person
¶
Bases:
A person.
Source code in myapp/models.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
Instructor
¶
Bases:
An instructor.
Source code in myapp/models.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
person = models.OneToOneField('myapp.Person', related_name='instructor', on_delete=(models.CASCADE), null=True, default=None)
class-attribute
instance-attribute
¶
course_terms = models.ManyToManyField('myapp.CourseTerm', related_name='instructors')
class-attribute
instance-attribute
¶
Meta
¶
Source code in myapp/models.py
156 157 | |
ordering = ['id']
class-attribute
instance-attribute
¶
__str__()
¶
Source code in myapp/models.py
159 160 | |
Student
¶
Bases:
A student.
Source code in myapp/models.py
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
person = models.OneToOneField('myapp.Person', related_name='student', on_delete=(models.CASCADE), null=True, default=None)
class-attribute
instance-attribute
¶
grades = models.ManyToManyField('myapp.Grade', related_name='student')
class-attribute
instance-attribute
¶
Meta
¶
Source code in myapp/models.py
178 179 | |
ordering = ['id']
class-attribute
instance-attribute
¶
__str__()
¶
Source code in myapp/models.py
181 182 | |
Grade
¶
Bases:
A grade for a CourseTerm instance
Source code in myapp/models.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
person = models.OneToOneField('myapp.Student', on_delete=(models.DO_NOTHING), related_name='grade')
class-attribute
instance-attribute
¶
course_term = models.OneToOneField('myapp.CourseTerm', on_delete=(models.DO_NOTHING), related_name='grade')
class-attribute
instance-attribute
¶
credits = models.FloatField(help_text='Credits attempted/earned')
class-attribute
instance-attribute
¶
grade_letter = models.CharField(max_length=2, choices=[(k, k) for k in [None, 'A', 'B', 'C', 'D', 'F', 'P']], default=None)
class-attribute
instance-attribute
¶
grade_value = models.FloatField(default=0.0, help_text='grade points (e.g. A is 4.0, F is 0.0)')
class-attribute
instance-attribute
¶
__str__()
¶
Source code in myapp/models.py
206 207 208 209 210 211 212 213 | |
NonModel
¶
Bases:
Make a concrete model that's not actually got a database under it.
Source code in myapp/models.py
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | |
field1 = models.CharField(max_length=20)
class-attribute
instance-attribute
¶
field2 = models.CharField(max_length=20, default='hi')
class-attribute
instance-attribute
¶
field3 = models.CharField(max_length=10, default='there')
class-attribute
instance-attribute
¶
Meta
¶
Source code in myapp/models.py
222 223 | |
managed = False
class-attribute
instance-attribute
¶
__str__()
¶
Source code in myapp/models.py
235 236 | |