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.


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 =
            for instance in instances:
                instance.lesson_at =['date_input']
            # Print para Debug
            #for name in request.POST:
            #    print("{}: {}".format(name, request.POST.getlist(name)))
            return render(request, 'schooladmin/turmas.html')
            formset = RegisterInLineFormSet(instance=alunos)
            return render(request, 'schooladmin/registers.html', {'formset': formset, 'turma': t})


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”.