Python Django Models Unique Rows

In your Django models.py file, you can define unique rows by using the unique=True parameter inside a field in your model class. This will enforce uniqueness at the database level. Here's a simple example:

from django.db import models

class YourModel(models.Model):
    your_field = models.CharField(unique=True, max_length=100)

In this example, the your_field in the YourModel class will have unique rows enforced at the database level. If you try to save a new instance with a value that already exists in the your_field, it will raise a validation error.