I have a (duplicate detection) query in Django that I want to apply for several models:
Cooperation.objects.values('seo__slug').annotate(count=Count('id')).values('seo__slug).filter(count__gt=1)
Article.objects.values('seo__slug').annotate(count=Count('id')).values('seo__slug).filter(count__gt=1)
City.objects.values('seo__slug').annotate(count=Count('id')).values('seo__slug).filter(count__gt=1)
Is there a coding concept so that I can do this in a loop. e.g (Pseudo Code, this below is not working)
information_objects = ['Cooperation', 'Article', 'City']
for obj in information_objects:
obj.objects.values('seo__slug').annotate(count=Count('id')).values('seo__slug).filter(count__gt=1)
I hope I can get my question across. If anybody can tell me if this concept is supported in Django please let me know.