Advertisement
Guest User

Untitled

a guest
Mar 17th, 2020
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. #####HTML###########
  2. <a href="delete/{{comp.id}}"> <span class="fa fa-trash-o"></span><a>
  3. #######################################################################
  4.  
  5. #################views.py##############################################
  6. def delete_comp(request, id):
  7.     try:
  8.         competition = Competition.objects.get(id=id)
  9.         competition.delete()
  10.         return redirect('start/')
  11.     except Person.DoesNotExist:
  12.         return HttpResponseNotFound("<h2>Competition not found</h2>")
  13. ######################################################################
  14.  
  15. #################urls.py##############################################
  16. path('deletecomp/<int:id>/', delete_comp),
  17. ######################################################################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement