|
|
|
@ -75,9 +75,15 @@ class Course(models.Model): |
|
|
|
update_at = models.DateTimeField(auto_now=True) |
|
|
|
update_at = models.DateTimeField(auto_now=True) |
|
|
|
|
|
|
|
|
|
|
|
def save(self, *args, **kwargs): |
|
|
|
def save(self, *args, **kwargs): |
|
|
|
print(self.title) |
|
|
|
if not self.slug: |
|
|
|
self.slug = slugify(self.title[:100] + '_' + str(uuid4())[:6], allow_unicode=True) |
|
|
|
self.slug = slugify( |
|
|
|
print(self.slug) |
|
|
|
self.title[:100], |
|
|
|
|
|
|
|
allow_unicode=True |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if Course.objects.filter(slug=self.slug).exists(): |
|
|
|
|
|
|
|
self.slug += '_' + str(uuid4())[:6] |
|
|
|
|
|
|
|
|
|
|
|
return super().save() |
|
|
|
return super().save() |
|
|
|
|
|
|
|
|
|
|
|
@property |
|
|
|
@property |
|
|
|
|