Skip to content

Commit

Permalink
Merge pull request #294 from clabs/dev
Browse files Browse the repository at this point in the history
fix empty slug
  • Loading branch information
ethrgeist authored Nov 18, 2024
2 parents bfa58de + 5ed4ac3 commit df96375
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/rockon/base/models/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from os import path

from django.templatetags.static import static
from slugify import slugify

from rockon.library import UploadToPathAndRename
from rockon.library.custom_model import CustomModel, models
Expand Down Expand Up @@ -73,6 +74,13 @@ def __str__(self):
class Meta:
ordering = ["start"]

def save(self, *args, **kwargs):
if not self.slug:
self.slug = slugify(self.name)
if self.slug == "":
self.slug = str(self.id)
super().save(*args, **kwargs)

def get_image_url(self):
if self.image:
return self.image.url
Expand Down

0 comments on commit df96375

Please sign in to comment.