def is_valid(self): succ = forms.ModelForm.is_valid(self) if self.data["title"] != "": directory = CHALLENGES_ROOT + self.data["title"].replace(" ", "_") + "/" if os.path.exists(directory): succ = False append_error(self, "title", "Challenge with this Title already exists.") return succ
def is_valid(self): succ = forms.ModelForm.is_valid(self) if self.data["name"] != "" and self.data["target_challenge"] != "": challenge = Challenge.objects.get(id=self.data["target_challenge"]) directory = challenge.directory + "bots/" + self.data["name"].replace(" ", "_") + "/" if os.path.exists(directory): succ = False append_error(self, "name", "Bot with this Name already exists.") return succ