Begin implementing ad deduplication and re-enable releasing
This commit is contained in:
@@ -81,6 +81,19 @@ class AdRedist(LoginRequiredMixin, OTPRequiredMixin, View):
|
||||
return render(request, self.template_name, context)
|
||||
|
||||
|
||||
class AdDedup(LoginRequiredMixin, OTPRequiredMixin, View):
|
||||
template_name = "mixins/partials/notify.html"
|
||||
|
||||
def get(self, request):
|
||||
platforms = get_platforms(request.user)
|
||||
for platform in platforms:
|
||||
run = synchronize_async_helper(AgoraClient(platform))
|
||||
synchronize_async_helper(run.strip_duplicate_ads())
|
||||
|
||||
context = {"class": "success", "message": "Ads deduplicated"}
|
||||
return render(request, self.template_name, context)
|
||||
|
||||
|
||||
class AdList(LoginRequiredMixin, OTPRequiredMixin, ObjectList):
|
||||
list_template = "partials/ad-list.html"
|
||||
model = Ad
|
||||
@@ -123,6 +136,14 @@ class AdList(LoginRequiredMixin, OTPRequiredMixin, ObjectList):
|
||||
"icon": "fa-solid fa-bomb",
|
||||
"confirm": True,
|
||||
},
|
||||
{
|
||||
"url": reverse("ad_dedup"),
|
||||
"action": "deduplicate",
|
||||
"method": "get",
|
||||
"label": "Deduplicate ads",
|
||||
"icon": "fa-thin fa-copy",
|
||||
"confirm": True,
|
||||
},
|
||||
]
|
||||
return context
|
||||
|
||||
|
||||
Reference in New Issue
Block a user