MultipleChoiceField - invalid_choice error - Select a valid choice. SomeChoice is not one of the available choices
<p>I am creating a form in django, hoping to allow users to delete some of their devices. When I click on the submit button of my form, I keep getting the message: <code>Select a valid choice. &lt;Some choice&gt; is not one of the available choices</code>. Here is my code. Thanks a lot :)</p>

<h1>forms.py</h1>

<pre><code>class DeleteDeviceForm(forms.Form):
    devices = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple)
</code></pre>

<h1>views.py</h1>

<pre><code>def delete_device(request):
    if request.method == 'POST':
        deletedeviceform = DeleteDeviceForm(request.POST)
        if deletedeviceform.is_valid():
            devicelist = request.POST.getlist('devices')
#will put other stuff there to process the data later, just want to access list now
            return HttpResponseRedirect('/accounts/loggedin', {"devicelist": devicelist, })

    else: #if not a POST request 
        userid = request.user.profile.pk
        devices = Device.objects.filter(user_id=userid)
        deletedeviceform = DeleteDeviceForm()
        deletedeviceform.fields['devices'].choices = [(x.id, x) for x in devices]

    return render(request, 'userprofile/delete_device.html', {"full_name": request.user.username, "deletedeviceform": deletedeviceform,})
</code></pre>

<p>Note that: I don't have a model for this form</p>