Skip to content

Commit

Permalink
Bugfix creating slug in JobOffer model
Browse files Browse the repository at this point in the history
  • Loading branch information
DEENUU1 committed Dec 27, 2023
1 parent cad27c9 commit 192919f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion offer/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,10 @@ def get_random_string(length=20):
def save(self, *args, **kwargs):
if not self.slug:
random_str = self.get_random_string()
self.slug = f"{self.title}{random_str}"
transformed_title = self.transform_title(self.title)
self.slug = f"{transformed_title}{random_str}"
super().save(*args, **kwargs)

@staticmethod
def transform_title(title: str) -> str:
return title.replace(" ", "-").lower()

0 comments on commit 192919f

Please sign in to comment.