Fix bug for multiple order maker telegram enabling. Add TG to admin panel.

This commit is contained in:
Reckless_Satoshi 2022-02-24 05:01:17 -08:00
parent 30e35f8973
commit aa1994b1f1
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
2 changed files with 4 additions and 1 deletions

View File

@ -103,6 +103,7 @@ class UserProfileAdmin(AdminChangeLinksMixin, admin.ModelAdmin):
"avatar_tag",
"id",
"user_link",
"telegram_enabled",
"total_contracts",
"platform_rating",
"total_ratings",

View File

@ -44,13 +44,15 @@ class Telegram():
def welcome(self, user):
lang = user.profile.telegram_lang_code
order = Order.objects.get(maker=user)
order = Order.objects.get(maker=user, status=Order.Status.PUB)
print(str(order.id))
if lang == 'es':
text = f'Hola {user.username}, te enviaré un mensaje cuando tu orden con ID {str(order.id)} haya sido tomada.'
else:
text = f"Hey {user.username}, I will send you a message when someone takes your order with ID {str(order.id)}."
self.send_message(user, text)
user.profile.telegram_welcomed = True
user.profile.save()
return
def order_taken(self, order):