By default, Django does not enforce the uniqueness of slugs. However, you can add the unique=True parameter to the SlugField to ensure that each slug is unique within the model.
Here's an example:
from django.db import models
class MyModel(models.Model):
title = models.CharField(max_length=100)
slug = models.SlugField(unique=True)
def save(self, *args, **kwargs):
self.slug = self.title.replace(" ", "-").lower()
super().save(*args, **kwargs)
With unique=True, Django will raise an error if you try to save an object with a duplicate slug.