def clean_shopId(self): shop_id = self.cleaned_data["shopId"] if shop_id != settings.YANDEX_MONEY_SHOP_ID and not shop_id in Payment.get_used_shop_ids(): raise forms.ValidationError(self.error_messages[self.ERROR_MESSAGE_CODES.BAD_SHOP_ID]) return shop_id