예제 #1
0
class RecorderScheduledEntry(models.Model):
    id = models.CharField(max_length=36)
    name = models.CharField(max_length=256)
    recorder_id = models.CharField(max_length=36)
    suppress_primary_capture = models.BooleanField(default=False)
    suppress_secondary_capture = models.BooleanField(default=False)
    recorder_description = models.CharField(max_length=256)

    def __init__(self, *args, **kwargs):
        data = kwargs.get("data")
        if data is None:
            return super(RecorderScheduledEntry,
                         self).__init__(*args, **kwargs)

        self.id = data.get("Id")
        self.name = data.get("Name")
        self.suppress_primary_capture = (data.get("SuppressPrimaryCapture",
                                                  False) == "true")
        self.suppress_secondary_capture = (data.get("SuppressSecondaryCapture",
                                                    False) == "true")
        self.recorder_description = data.get("RecorderDescription")

    def to_json(self):
        return {
            'id': self.id,
            'name': self.name,
            'recorder_id': self.recorder_id,
            'suppress_primary_capture': self.suppress_primary_capture,
            'suppress_secondary_capture': self.suppress_secondary_capture,
            'recorder_description': self.recorder_description
        }

    def __str__(self):
        return json.dumps(self.to_json())
예제 #2
0
class Cohort(models.Model):
    academic_qtr_id = models.IntegerField()
    cohort_number = models.IntegerField()
    cohort_description = models.TextField()
    cohort_residency = models.CharField(max_length=255)
    admit_decision = models.CharField(max_length=255)
    protected_group = models.BooleanField()
    active_cohort = models.BooleanField()
    assigned_count = models.IntegerField()
예제 #3
0
class Quarter(models.Model):
    id = models.IntegerField()
    begin = models.DateTimeField()
    end = models.DateTimeField()
    active_ind = models.CharField(max_length=32)
    appl_yr = models.CharField(max_length=4)
    appl_qtr = models.CharField(max_length=1)
    is_current = models.BooleanField()
예제 #4
0
class ApplicationStatus(models.Model):
    is_seattle = models.BooleanField(default=False)
    is_bothell = models.BooleanField(default=False)
    is_tacoma = models.BooleanField(default=False)
    no_ug_app = models.BooleanField(default=False)
    is_freshman = models.BooleanField(default=False)
    is_returning = models.BooleanField(default=False)
    is_post_bac = models.BooleanField(default=False)
    is_international = models.BooleanField(default=False)
    is_transfer = models.BooleanField(default=False)
    is_ug_non_matriculated = models.BooleanField(default=False)
    quarter = models.CharField(max_length=16, null=True, blank=True)
    year = models.PositiveSmallIntegerField(null=True, blank=True)

    def json_data(self):
        data = {
            'is_seattle': self.is_seattle,
            'is_bothell': self.is_bothell,
            'is_tacoma': self.is_tacoma,
            'no_ug_app': self.no_ug_app,
            'is_freshman': self.is_freshman,
            'is_international': self.is_international,
            'is_post_bac': self.is_post_bac,
            'is_returning': self.is_returning,
            'is_transfer': self.is_transfer,
            'is_ug_non_matriculated': self.is_ug_non_matriculated,
            'quarter': self.quarter,
            'year': self.year
        }

        if data['is_freshman']:
            data['type'] = "Freshman"
        elif data['is_post_bac']:
            data['type'] = "Postbaccalaureate"
        elif data['is_ug_non_matriculated']:
            data['type'] = "Nonmatriculated"
        elif data['is_transfer']:
            data['type'] = "Transfer"

        if 'type' in data and data['is_international']:
            data['type'] = "International " + data['type']

        return data

    def __str__(self):
        return json.dumps(self.json_data())
예제 #5
0
class CohortAssignment(Assignment):
    cohort_number = models.IntegerField()
    override_previous = models.BooleanField()
    override_protected = models.BooleanField()

    def json_data(self):
        applicant_json = []
        for application in self.applicants:
            applicant_json.append(application.json_data())
        return {'applicants': applicant_json,
                'cohortNbr': int(self.cohort_number),
                'overridePreviousCohort': self.override_previous,
                'overridePreviousProtectedCohort': self.override_protected,
                'assignmentDetail': {'assignmentType': self.assignment_type,
                                     'academicQtrKeyId': self.quarter,
                                     'campus': int(self.campus),
                                     'comments': self.comments,
                                     'decisionImportUser': self.user}
                }
예제 #6
0
class Submission(models.Model):
    submission_id = models.IntegerField()
    body = models.TextField(null=True)
    attempt = models.IntegerField(max_length=2)
    submitted_at = models.DateTimeField()
    assignment_id = models.IntegerField()
    assignment_visible = models.BooleanField(null=True)
    workflow_state = models.CharField(max_length=100, null=True)
    preview_url = models.CharField(max_length=500)
    late = models.NullBooleanField()
    grade = models.TextField(max_length=12, null=True)
    score = models.DecimalField(max_digits=10, decimal_places=2, null=True)
    grade_matches_current_submission = models.NullBooleanField()
    url = models.CharField(max_length=500, null=True)
    grader_id = models.IntegerField()
    graded_at = models.DateTimeField(null=True)
    posted_at = models.DateTimeField(null=True)
    submission_type = models.CharField(max_length=100, null=True)

    def __init__(self, *args, **kwargs):
        self.attachments = []

        data = kwargs.get("data")
        if data is None:
            return super(Submission, self).__init__(*args, **kwargs)

        self.submission_id = data['id']
        self.body = data['body']
        self.attempt = data['attempt']
        if "submitted_at" in data and data["submitted_at"] is not None:
            self.submitted_at = dateutil.parser.parse(data["submitted_at"])
        self.assignment_id = data["assignment_id"]
        self.workflow_state = data["workflow_state"]
        self.preview_url = data["preview_url"]
        self.late = data["late"]
        self.grade = data["grade"]
        self.score = data["score"]
        self.grade_matches_current_submission = data.get(
            "grade_matches_current_submission")
        self.url = data["url"]
        self.grader_id = data["grader_id"]
        if "graded_at" in data and data["graded_at"] is not None:
            self.graded_at = dateutil.parser.parse(data["graded_at"])
        if "posted_at" in data and data["posted_at"] is not None:
            self.posted_at = dateutil.parser.parse(data["posted_at"])
        self.submission_type = data["submission_type"]

        # assignment_visible is not always present
        self.assignment_visible = data.get("assignment_visible")

        for attachment_data in data.get("attachments", []):
            self.attachments.append(Attachment(data=attachment_data))
예제 #7
0
 class ModelTest(models.Model):
     bools = models.BooleanField()
     chars = models.CharField(max_length=20)
     dates = models.DateField()
     datetimes = models.DateTimeField()
     decimals = models.DecimalField()
     floats = models.FloatField()
     ints = models.IntegerField()
     nullbools = models.NullBooleanField()
     posints = models.PositiveIntegerField()
     possmalls = models.PositiveSmallIntegerField()
     slugs = models.SlugField()
     smallints = models.SmallIntegerField()
     texts = models.TextField()
     texts2 = models.TextField()
     times = models.TimeField()
     urls = models.URLField()
예제 #8
0
 class ModelTest(models.Model):
     f1 = models.TextField()
     f2 = models.BooleanField()
예제 #9
0
        class ModelTest(models.Model):
            bools = models.BooleanField()

            def __init__(self, *args, **kwargs):
                pass