inline formset view error

I have this view which is given an HttpResponse error message and I can’t figure it out why it’s happening. Any help is very much appreciated.

view

def RegisterCreate(request, **kwargs):

    t = Turmas.objects.get(id=kwargs['pk'])
    alunos = Alunos.objects.filter(classeid=kwargs['pk'])

    RegisterInLineFormSet = inlineformset_factory(Alunos, Registers, form=AddRegisterForm)

    if request.method == "POST":
        formset = RegisterInLineFormSet(request.POST, request.FILES, instance=alunos)
        if formset.is_valid():
            instances = formset.save(commit=False)
            for instance in instances:
                instance.lesson_at = formset.data['date_input']
            # Print para Debug
            #for name in request.POST:
            #    print("{}: {}".format(name, request.POST.getlist(name)))
            formset.save()
            return render(request, 'schooladmin/turmas.html')
        else:
            formset = RegisterInLineFormSet(instance=alunos)
            return render(request, 'schooladmin/registers.html', {'formset': formset, 'turma': t})

form

class AddRegisterForm(forms.ModelForm):

    class Meta:
        model = Registers
        fields = '__all__'

the error message

Notice that the Request Method identified in the error message specifies GET.

Your view is not returning anything (returning None) if request.method != “POST”.