django queryset unique values

# Assuming you have a Django model named YourModel with a field named your_field

# Step 1: Import the necessary module
from django.db.models import Count

# Step 2: Use the annotate function to count occurrences of each value
queryset_with_counts = YourModel.objects.values('your_field').annotate(count=Count('your_field'))

# Step 3: Use the filter function to get only the unique values
unique_values_queryset = queryset_with_counts.filter(count=1)

# Step 4: Extract the unique values from the queryset
unique_values_list = unique_values_queryset.values_list('your_field', flat=True)