testing #22

Merged
pi-ux-ce merged 3 commits from testing into main 2026-07-10 11:17:42 +00:00
Showing only changes of commit 6f1c8cd8ff - Show all commits
@@ -1,8 +1,26 @@
from django.contrib import admin
from import_export.admin import ImportExportModelAdmin
from .models import TelegramData
from .utils import telegramUtils
@admin.action(description="Clear all expired messages")
def messages_cleaning(modeladmin, request, queryset):
telegram = telegramUtils()
telegram.clear_expired_messages()
# Register your models here.
@admin.register(TelegramData)
class JobAdmin(ImportExportModelAdmin):
list_display = ('message_id','chat_id','description','creation_date','expiration_date')
actions = [messages_cleaning]
def delete_queryset(self, request, queryset):
"""Given a queryset, delete it from the database."""
print("here")
telegram = telegramUtils()
list_of_message_id = list(queryset.all().values_list('message_id',flat=True))
telegram.delete_message(list_of_message_id)
#no queryset.delete() because it is specified in delete_message function already