0

After filtering and updating I have to delete the objscts, How to solve the isuue,

AttributeError: 'int' object has no attribute 'delete'

 def handle(self, *args, **options):
       trees.objects.filter(old=True).update(new=False).delete()

My objective is to first filte all the old trees as True and new as False then updating I have to delete all the object list.

1 Answers1

0

You then filter with old=True, new=False, so you do not update:

def handle(self, *args, **options):
    trees.objects.filter(old=True, new=False).delete()
Willem Van Onsem
  • 443,496
  • 30
  • 428
  • 555