A short snippet that will delete records from the database. The deletion will occur when you visit the delete_id/somenumber/ url (defined inside urls.py), which will trigger the delete_view function (also defined inside urls.py), delete the record from the database (forms.py) and redirect to the /redirect-url/ (defined inside views.py).

Add an url: urls.py

url(r'^delete_id/(?P<id_to_delete>\d+)$', 'delete_view'),

Create a view that will delete the record: views.py

def delete_view(request, id_to_delete):
    return HttpResponseRedirect("/redirect-url/")