A
A
Almaz Akimov2021-12-16 11:04:58
Python
Almaz Akimov, 2021-12-16 11:04:58

How to delete entries in the database that are not in the list?

There is a list of required movies_dont_delete entries.
So I can only delete them

movies_dont_delete = ['111028821', '121039321', '121038721']
Movie.objects.filter(movie_pu_number__in=movies_dont_delete).delete()

And how to delete except for them?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Kitaev, 2021-12-16
@GolosB

exclude?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question