Adding get to generic.CreateView subclass doesn't show the form of the signup page

I included a get() function only to get request which I then process to send in some data to the signup template.

class SignUp(generic.CreateView):
    
    form_class = UserCreationForm    
    success_url = reverse_lazy('dashboard')
    template_name = 'signup.html'
    
    def get(self, request, *args, **kwargs):
        site = processSiteInfo(self.request)
        context = locals()
        context['site'] = site        
        return render(self.request, self.template_name, context)

    def form_valid(self, form):        
        
        username, password = form.cleaned_data.get('username'), form.cleaned_data.get('password1')
        
        view = super(SignUp, self).form_valid(form)
        user = authenticate(username=username, password=password)
        login(self.request, user)
        return view

But now, after adding get, the signup page with the form doesn’t show. The page with the header and footer etc loads, it’s the form that doesn’t show - no errors either.

This is empty :

{% load widget_tweaks %}
{% for field in form %}
.
.
.
{% endfor %}

I got it solved :

    def get_context_data(self, **kwargs):
        context = super(SignUp, self).get_context_data(**kwargs)
        site = processSiteInfo(self.request)
        context['site'] = site
        return context

But wondering why this isn’t well documented.

Actually, there’s a whole section of the docs dedicated to the Django Generic Class-Based Views.

It starts with Class-Based Views.

The means of adding data to the context through the use of get_context_data is documented at Adding extra context.

There’s also the Built-in CBV API reference docs that would point you to CreateView, which builds upon the information presented in the earlier pages, Base views and Generic Display views

So I don’t think is the case that it’s not well documented. I think the larger issue is that you need to know quite a bit to understand the information being presented and the value of that information being provided. (Unfortunately, I find this issue to be more and more common as frameworks become more intricate and layered on top of other layers. I feel sorry for anyone just getting started in the JavaScript ecosystem…)

I know that these docs are not the easiest to learn from. At a minimum, there is the assumption that the person reading those docs is familiar with Python classes and the mechanics of class inheritance.

Fortunately, there are two excellent resources also available for helping to understand what’s happening within the generic CBVs - Classy ClassBased Views and the CBV Diagrams page.