[Answer]-Django: deleted model objects regenerate themselves in postgresal

1👍

Databases seldom auto-populate themselves out of thin air and fresh water, so you very probably have some code somewhere that creates Feed instances (signal, cron job, whatever, doesn’t even have to be python code).

0👍

try:

feeds = Feed.objects.annotate(num_subs=Count('subscriptions')).filter(num_subs=0).all().delete()
👤levi

Leave a comment