def clean_scid(self): scid = self.cleaned_data["scid"] if scid != settings.YANDEX_MONEY_SCID and not scid in Payment.get_used_scids(): raise forms.ValidationError(self.error_messages[self.ERROR_MESSAGE_CODES.BAD_SCID]) return scid