Exemplo n.º 1
0
    def clean(self):
        self.Title = clean_text(self.Title)
        self.GeneralDescription = clean_text(self.GeneralDescription)
        self.StudentsTaskDescription = clean_text(self.StudentsTaskDescription)

        min_std = self.NumStudentsMin
        max_std = self.NumStudentsMax
        if min_std and max_std:
            if min_std > max_std:
                raise ValidationError("Minimum number of students cannot be higher than maximum.")
        else:
            raise ValidationError("Min or max number of students cannot be empty")
Exemplo n.º 2
0
 def clean(self):
     self.Caption = clean_text(self.Caption)
     if self.File:
         if get_ext(self.File.name) not in settings.ALLOWED_PUBLIC_FILES:
             raise ValidationError(
                 'This file type is not allowed. Allowed types: ' +
                 print_list(settings.ALLOWED_PUBLIC_FILES))
Exemplo n.º 3
0
 def clean(self):
     self.Caption = clean_text(self.Caption)
     if self.File:
         if get_ext(
                 self.File.name) not in self.Type.get_allowed_extensions():
             raise ValidationError(
                 'This file type is not allowed. Allowed types: ' +
                 print_list(self.Type.get_allowed_extensions()))
Exemplo n.º 4
0
 def clean(self):
     ws = GradeCategory.objects.filter(TimeSlot=get_timeslot_id())
     if self.id:
         ws = ws.exclude(id=self.id)
     try:
         w = ws.aggregate(Sum('Weight'))['Weight__sum'] + self.Weight
     except:
         w = self.Weight
     if w > 100:
         raise ValidationError(
             "Total weight of categories should be below 100%, it is now {}%!"
             .format(w))
     self.Name = clean_text(self.Name)
Exemplo n.º 5
0
 def clean(self):
     self.Feedback = clean_text(self.Feedback)
Exemplo n.º 6
0
 def clean(self):
     self.Message = clean_text(self.Message)
Exemplo n.º 7
0
 def clean(self):
     self.Comments = clean_text(self.Comments)
     self.Grade = quantize_number(self.Grade,
                                  base=settings.CATEGORY_GRADE_QUANTIZATION
                                  )  # rounds grade to step from settings.
Exemplo n.º 8
0
 def clean(self):
     self.Description = clean_text(self.Description)
     self.Name = clean_text(self.Name)
Exemplo n.º 9
0
 def clean(self):
     self.Explanation = clean_text(self.Explanation)
Exemplo n.º 10
0
 def clean(self):
     # file extensions are cleaned in form.
     self.Caption = clean_text(self.Caption)
Exemplo n.º 11
0
 def clean_Subject(self):
     return clean_text(self.cleaned_data.get('Subject'))
Exemplo n.º 12
0
 def clean(self):
     self.Name = clean_text(self.Name)
     self.ShortName = clean_text(self.ShortName)
Exemplo n.º 13
0
 def clean(self):
     self.Caption = clean_text(self.Caption)
Exemplo n.º 14
0
 def clean(self):
     self.Name = clean_text(self.Name)
Exemplo n.º 15
0
 def clean_students(self):
     return clean_text(self.cleaned_data.get('students'))
Exemplo n.º 16
0
 def clean(self):
     # self.Info = clean_text(self.Info)
     self.FullName = clean_text(self.FullName)
     self.ShortName = clean_text(self.ShortName)
Exemplo n.º 17
0
 def clean_Message(self):
     return clean_text(self.cleaned_data.get('Message'))