Hey there, I am trying to delete Events as chosen by a by a user using check boxes to check of which events they want to be deleted. But for some reason whenever I call request.POST.get('event_list') Nothing is received even though boxes are checked and I end up with nothing. Here is my template and the view that should be deleting the chosen events.
{% if event_list %}
{% for event in event_list%}
{%csrf_token%}
<input type="checkbox" name="event_list"
id="event{{ forloop.counter }}" />
<label for="event{{ forloop.counter }}">{{ event.title }}</
label><br />
{% endfor %}
<input type = 'submit' value = 'delete checked'>
</form>
<p>{{removal}}<p/> {%comment%} this is what should be
removed{%endcomment%}
{% if delete_error %}
<p>{{delete_error}}</p>
{% endif %}
views.py
def EventDelete(request):
removal = request.POST.get('event_list')
if removal:
removal.delete()
else:
delete_error = "You didn't delete anything"
return redner_to_response("detail.html", {'delete_error':
delete_error, 'removal': removal},
context_instance=RequestContext(request))
Im not sure why removal doesn't have anything in it, shouldn't it have the titles of the events in it? Unfortunately I don't know much about html and its workings :( I would really appreciate the help :) I feel like it is a simple fix and im just missing a small detail. Thanks :)