Submission¶
Qualified name: tin.apps.submissions.models.Submission
- class Submission(*args, **kwargs)[source]¶
Bases:
ModelA single submission for an assignment.
- Parameters:
id (BigAutoField) – Primary key: ID
date_submitted (DateTimeField) – Date submitted
last_run (DateTimeField) – Last run
has_been_graded (BooleanField) – Has been graded
complete (BooleanField) – Complete
kill_requested (BooleanField) – Kill requested
grader_pid (IntegerField) – Grader pid
grader_start_time (FloatField) – Grader start time
points_received (DecimalField) – Points received
file (FileField) – File
grader_output (CharField) – Grader output
grader_errors (CharField) – Grader errors
Relationship fields:
- Parameters:
assignment (
ForeignKeytoAssignment) – Assignment (related name:submissions)student (
ForeignKeytoUser) – Student (related name:submissions)
Reverse relationships:
- Parameters:
final_submission (Reverse
OneToOneFieldfromPublishedSubmission) – The final submission of this submission (related name ofsubmission)comments (Reverse
ForeignKeyfromComment) – All comments of this submission (related name ofsubmission)
Methods
Create a backup copy of the student's code submission
get_absolute_urlget_next_by_date_submittedFinds next instance based on
date_submitted.get_previous_by_date_submittedFinds previous instance based on
date_submitted.publishrerunSave the student's code submission to a file
Unpublish a submission
Attributes
assignmentType:
ForeignKeytoAssignmentassignment_idInternal field, use
assignmentinstead.backup_file_pathchannel_group_namecommentsType: Reverse
ForeignKeyfromCommentcompleteType:
BooleanFielddate_submittedType:
DateTimeFieldfileType:
FileFieldfile_headerfile_pathfile_textfile_text_with_headerfinal_submissionType: Reverse
OneToOneFieldfromPublishedSubmissionformatted_gradegrade_percentgrade_percent_numgrader_errorsType:
CharFieldgrader_outputType:
CharFieldgrader_pidType:
IntegerFieldgrader_start_timeType:
FloatFieldhas_been_gradedType:
BooleanFieldidType:
BigAutoFieldis_latestis_latest_publishis_on_timeis_publishedkill_requestedType:
BooleanFieldlast_runType:
DateTimeFieldobjectspoint_overridepointspoints_possiblepoints_receivedType:
DecimalFieldpublished_submissionrerun_colorstudentType:
ForeignKeytoUserstudent_idInternal field, use
studentinstead.wrapper_file_path- exception DoesNotExist¶
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
MultipleObjectsReturned
- create_backup_copy(submission_text: str) None[source]¶
Create a backup copy of the student’s code submission
- save_file(submission_text: str) None[source]¶
Save the student’s code submission to a file
Warning
Writing to files in directories not controlled by us without some form of sandboxing is a security risk. Most notably, users can use symbolic links to trick you into writing to another file, outside the directory. This solution is very hacky, but we don’t have another good way of doing this.