Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def delete_all_user_posts(self, request, queryset):
for obj in queryset:
user = obj.user
user.is_active = False
user.save()
Post.objects.filter(user=obj.user).delete()
Comments.objects.filter(user=obj.user).delete()