Closed Mirror83 closed 8 months ago
Okay the logic, in the blog model, there are three fields; author type, author user and author club, so we will check what the other type is and update accordingly and save the slug before creation
def save(self, *args, **kwargs):
base_slug = self.title
if self.author_type == "user":
base_slug += f' {self.author_user.username}'
if self.author_type == "club":
base_slug += f' {self.author_club.club_name}'
self.slug = slugify(base_slug)
super().save(*args, **kwargs)
@muceraaa please handle that:
Include the blog username in the slug, so that different authors can have blogs with the same title. Currently, the slug only includes the title of the blogs.