mirror of
https://github.com/ae-utbm/sith.git
synced 2026-10-30 22:29:32 +00:00
more precise error messages when searching users for click
This commit is contained in:
1 parent
366551559d
commit
01edf1f688
2 files changed
+22
-3
No files matched your search
+7
-1
@@ -130,8 +130,14 @@ class GetUserForm(forms.Form):
|
||||
elif cleaned_data["id"]:
|
||||
customer = Customer.objects.filter(user=cleaned_data["id"]).first()
|
||||
|
||||
if customer is None or not customer.can_buy:
|
||||
if customer is None:
|
||||
raise forms.ValidationError(_("User not found"))
|
||||
if not customer.can_buy:
|
||||
raise forms.ValidationError(_("This user cannot buy items on counters."))
|
||||
if customer.user.is_banned_counter:
|
||||
raise forms.ValidationError(
|
||||
_("This user is banned from AE places. Take him/her out if you can.")
|
||||
)
|
||||
cleaned_data["user_id"] = customer.user_id
|
||||
cleaned_data["user"] = customer.user
|
||||
return cleaned_data
|
||||
|
||||
Reference in new issue
Block a user