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.
多くの異なるビューに次の django ビューを使用していますが、それを呼び出したビューにリダイレクトする方法はありますか?
def delete_image(request,id,image_id): ImagenAvaluo.objects.filter(image_id=image_id).delete() return calling_view(request,id)
別の関数を作成し、それをいくつかのビューで使用します。
def delete_images(image_id): ImagenAvaluo.objects.filter(image_id=image_id).delete()
そうすれば、どのビューが他のどのビューを呼び出したかを追跡する必要がなくなります。requestまた、オブジェクトを渡す手間も省けます。
request