code: def clean_unique_fields(self):
          
          if not self.unique_fields:
              return
  
          keys = set()
          duplicates = []
  
          for form in self.forms:
              key = tuple(form.cleaned_data[field] for field in self.unique_fields)
              if key in keys:
                  duplicates.append(",".join(key))
              else:
                  keys.add(key)
  
          if duplicates:
              raise forms.ValidationError(
                  "Fields %s should be unique; found duplicates for %s" % (
                      ','.join(self.unique_fields), duplicates))
docs: Ensure 'unique fields' are unique among entered data.