33 lines
944 B
Python
33 lines
944 B
Python
from django.contrib import admin
|
|
from import_export.admin import ImportExportModelAdmin
|
|
from .models import streamingData
|
|
from .utils import full_testing
|
|
|
|
|
|
|
|
@admin.action(description="check the URLs")
|
|
def check(modeladmin, request, queryset):
|
|
for query in queryset:
|
|
print(query)
|
|
website_url = query.url
|
|
status=full_testing(website_url)
|
|
print(status)
|
|
query.status = status
|
|
query.save(update_fields=["status"])
|
|
|
|
|
|
# modeladmin.message_user(
|
|
# request,
|
|
# ngettext(
|
|
# "%d episode was successfully marked as seen.",
|
|
# "%d episodes were successfully marked as seen.",
|
|
# updated,
|
|
# )
|
|
# % updated,
|
|
# messages.SUCCESS,
|
|
# )
|
|
|
|
@admin.register(streamingData)
|
|
class streamingAdmin(ImportExportModelAdmin):
|
|
list_display = [field.name for field in streamingData._meta.fields if field.name != 'id']
|
|
actions = [check] |