|
|
|
@ -93,17 +93,17 @@ class Course(BaseModel, DeactivatedMixin): |
|
|
|
def __str__(self): |
|
|
|
def __str__(self): |
|
|
|
return str(self.id) + ' ' + self.title |
|
|
|
return str(self.id) + ' ' + self.title |
|
|
|
|
|
|
|
|
|
|
|
def save(self, *args, **kwargs): |
|
|
|
# def save(self, *args, **kwargs): |
|
|
|
if not self.slug: |
|
|
|
# if not self.slug: |
|
|
|
self.slug = slugify( |
|
|
|
# self.slug = slugify( |
|
|
|
self.title[:90], |
|
|
|
# self.title[:90], |
|
|
|
allow_unicode=True |
|
|
|
# allow_unicode=True |
|
|
|
) |
|
|
|
# ) |
|
|
|
|
|
|
|
|
|
|
|
if Course.objects.filter(slug=self.slug).exclude(id=self.id).exists(): |
|
|
|
# if Course.objects.filter(slug=self.slug).exclude(id=self.id).exists(): |
|
|
|
self.slug += '_' + str(uuid4())[:6] |
|
|
|
# self.slug += '_' + str(uuid4())[:6] |
|
|
|
|
|
|
|
|
|
|
|
return super().save() |
|
|
|
# return super().save() |
|
|
|
|
|
|
|
|
|
|
|
@property |
|
|
|
@property |
|
|
|
def url(self): |
|
|
|
def url(self): |
|
|
|
|