(self)
| 55 | |
| 56 | class BaseFavoriteDrinksFormSet(BaseFormSet): |
| 57 | def clean(self): |
| 58 | seen_drinks = [] |
| 59 | |
| 60 | for drink in self.cleaned_data: |
| 61 | if drink["name"] in seen_drinks: |
| 62 | raise ValidationError("You may only specify a drink once.") |
| 63 | |
| 64 | seen_drinks.append(drink["name"]) |
| 65 | |
| 66 | |
| 67 | # A FormSet that takes a list of favorite drinks and raises an error if |
no test coverage detected