nesl / AutoGrader

Web frontend of Embedded Systems Auto Grader project
1 stars 0 forks source link

ChoiceForm.choice value definition should be string #113

Closed Klamath233 closed 7 years ago

Klamath233 commented 7 years ago
    AUTHOR_OPTION_ALL = 0
    AUTHOR_OPTION_CUSTOMIZED = 1
    AUTHOR_SCOPE_CHOICES = (
            (AUTHOR_OPTION_ALL, 'All students in the course'),
            (AUTHOR_OPTION_CUSTOMIZED, 'Specify a student'),
    )

Choices like AUTHOR_OPTION_ALL defined as numbers cause extra conversion in parsing them.

    if int(self.cleaned_data['submission_scope']) == RegradeForm.SUBMISSION_OPTION_CUSTOMIZED:

Proposed solution: define them as string directly.

TimeString commented 7 years ago

GitHub does not close the issue automatically?

Klamath233 commented 7 years ago

Dunno. Closing it manually.