mirror of
https://github.com/Findus23/acronomy.git
synced 2024-09-19 15:33:45 +02:00
default letter highlighting
This commit is contained in:
parent
6b33fffaee
commit
8e467b9ba4
1 changed files with 5 additions and 0 deletions
|
@ -32,6 +32,11 @@ class Acronym(models.Model):
|
|||
|
||||
def save(self, *args, **kwargs):
|
||||
self.description_html = md_to_html(self.description_md)
|
||||
if not self.acro_letters:
|
||||
self.acro_letters = [0]
|
||||
for pos, char in enumerate(self.full_name):
|
||||
if char == " " and pos <= len(self.full_name):
|
||||
self.acro_letters.append(pos + 1)
|
||||
if not self.slug:
|
||||
self.slug = slugify(self.name)
|
||||
super(Acronym, self).save(*args, **kwargs)
|
||||
|
|
Loading…
Reference in a new issue