From 14cdb191c0fe8f4ce6c39b413b9eb404a05e57b0 Mon Sep 17 00:00:00 2001 From: Joliver Date: Sat, 21 Sep 2024 21:44:55 +0200 Subject: [PATCH] fix: slug now gets created separate to SlugField upon creation --- nablapps/events/models/event.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nablapps/events/models/event.py b/nablapps/events/models/event.py index 3da5d847..b2be701b 100644 --- a/nablapps/events/models/event.py +++ b/nablapps/events/models/event.py @@ -8,6 +8,7 @@ from django.core.exceptions import ValidationError from django.db import IntegrityError, models from django.urls import reverse +from django.utils.text import slugify from nablapps.core.models import TimeStamped, WithPicture from nablapps.jobs.models import Company @@ -124,6 +125,8 @@ def get_short_name(self): ) def save(self, *args, **kwargs): + if not self.slug: + self.slug = slugify(self.headline) super().save(*args, **kwargs) self.move_waiting_to_attending()