Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私の現在のコードは次のとおりです。
suggestions = Photo.objects.extra(where=['id!=%s'], params=[p.id]).order_by('?')[:10]
もっと良い解決策があるのだろうかと思っていました。
基本的なものを使用できるようですexclude:
exclude
suggestions = Photo.objects.exclude(id=p.id).order_by('?')[:10]