diff --git a/api/admin.py b/api/admin.py index 2e71e0fa..a04c0de5 100644 --- a/api/admin.py +++ b/api/admin.py @@ -103,6 +103,7 @@ class UserProfileAdmin(AdminChangeLinksMixin, admin.ModelAdmin): "avatar_tag", "id", "user_link", + "telegram_enabled", "total_contracts", "platform_rating", "total_ratings", diff --git a/api/messages.py b/api/messages.py index bddb8424..1e42e8a9 100644 --- a/api/messages.py +++ b/api/messages.py @@ -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):