0

I'm working on a Django project and need some help .

I am trying to delete duplicated data from my table, i tried this :

for sign in Signal.objects.values_list('signal_name', flat=True).distinct():
    Signal.objects.filter(pk__in=Signal.objects.filter(signal_name=sign).values_list('id', flat=True)[1:]).delete()

But it deletes all the data from the table, anyone knows what's the problem with my code?

cobalt
  • 1
  • 1

0 Answers0