add etherpad-check to clean method

This commit is contained in:
2022-03-17 12:25:25 +00:00
parent ae71180e65
commit f789fc17cb

View File

@@ -123,7 +123,6 @@ class Document(models.Model):
self.slug = slugify(self.title)
pad_name = slugify(str(self.date) + "-" + self.task.slug + "-" + self.slug)
if len(pad_name) > 50:
raise ValidationError(
_(
@@ -132,12 +131,11 @@ class Document(models.Model):
params={"length": len(pad_name), "pad_name": pad_name},
)
def save(self, *args, **kwargs):
self.etherpad_key = create_pad(
slugify(str(self.date) + "-" + self.task.slug + "-" + self.slug)
)
super().save(*args, **kwargs)
self.etherpad_key = create_pad(pad_name)
if not self.etherpad_key:
raise ValidationError(
_(f"Etherpad '{pad_name}' konnte nicht erstellt werden."),
)
def __str__(self):
return self.title