1
0
Fork 0
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:
Lukas Winkler 2020-07-19 21:48:41 +02:00
parent 6b33fffaee
commit 8e467b9ba4
Signed by: lukas
GPG key ID: 54DE4D798D244853

View file

@ -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)