简体   繁体   中英

I want to save the current user when it delete a record in django

Suppose i have a DeleteView in django which succesfully delete the particular record but i also want to save which user delete the record for security purpose. I can save current user in CreateView,UpdateView but i don't know how to record current user when it delete a particular record.

class PostDelete(DeleteView):
model = Post
template_name = 'post/confirm_delete.html'
success_url = reverse_lazy('post-delete')

Thanks

Suppose i have a DeleteView in django which succesfully delete the particular record but i also want to save which user delete the record for security purpose. I can save current user in CreateView,UpdateView but i don't know how to record current user when it delete a particular record.

class PostDelete(DeleteView):
model = Post
template_name = 'post/confirm_delete.html'
success_url = reverse_lazy('post-delete')

Thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM