Ошибка Объект 'RecordSearchForm' не имеет атрибута 'is_game'

def index(request):
    game_data = GameDataEntry()
    update_progress = ProjectProgressEntry()
    work_hours = WorkHoursEntry()
    if request.method == "GET":
        form = RecordSearchForm(data=request.GET)
        if form.is_game is True:
            query = request.GET.get('entry_date')
            object_list = game_data.objects.filter(entry_date=query)
            return HttpResponse(object_list, content_type='text/plain')
        if form.is_work is True:
            query = request.GET.get('entry_date')
            object_list = work_hours.objects.filter(entry_date=query)
            return HttpResponse(object_list, content_type='text/plain')
        if form.is_Progress is True:
            query = request.GET.get('entry_date')
            object_list = update_progress.objects.filter(entry_date=query)
            return HttpResponse(object_list, content_type='text/plain')
    else:
        form = RecordSearchForm()

    return render(request, 'index.html', context={'form': form})

Это мой класс Form

class RecordSearchForm(forms.Form):
    is_Progress = forms.BooleanField(widget=forms.CheckboxInput(
        attrs={'class': 'form-check-input', "id": "is_progress_update", "type": 'checkbox'}))
    is_game = forms.BooleanField(widget=forms.CheckboxInput(
        attrs={'class': 'form-check-input', "id": "is_game_update", "type": "checkbox"}))
    is_work = forms.BooleanField(widget=forms.CheckboxInput(
        attrs={'class': 'form-check-input', "id": "is_work_entry", "type": "checkbox"}))
    game_name = forms.ModelChoiceField(widget=forms.Select(
        attrs={'class': 'form-control', "id": "game_name"}), queryset=Games.objects.all())
    entry_date = forms.DateField(widget=forms.DateInput(
        attrs={'class': 'form-control', "id": "date_entry", "type": "date"}))

Я пытаюсь сделать функцию поиска, чтобы получить записи на основе даты записи для моделей, которые являются либо разработкой игры, либо готовыми обновлениями, либо рабочими часами, но она говорит, что is_game не является атрибутом моей формы, но он явно там есть. может ли кто-нибудь сказать мне, что я делаю неправильно или что я пропустил

You can get the attributes from the .cleaned_data [Django-doc] after validating the form, so:

def index(request):
    game_data = GameDataEntry()
    update_progress = ProjectProgressEntry()
    work_hours = WorkHoursEntry()
    form = RecordSearchForm(data=request.GET)
    if form.is_valid():
        result = form.cleaned_data
        query = result['entry_date']
        if result['is_game']:
            object_list = game_data.objects.filter(entry_date=query)
            return HttpResponse(object_list, content_type='text/plain')
        if result['is_work']:
            object_list = work_hours.objects.filter(entry_date=query)
            return HttpResponse(object_list, content_type='text/plain')
        if result['is_Progress']:
            object_list = update_progress.objects.filter(entry_date=query)
            return HttpResponse(object_list, content_type='text/plain')
    else:
        form = RecordSearchForm()

    return render(request, 'index.html', context={'form': form})
Вернуться на верх