Możemy to zrobić w Django:Django Widok: get_context_data() vs get()
class LoginView(generic.FormView):
def get_context_data(self, **kwargs):
common = CommonView(self, **kwargs)
context = super(LoginView, self).get_context_data(**kwargs)
context['common'] = common.infos
czyli
class LoginView(generic.FormView):
def get(self, request, *args, **kwargs):
common = CommonView(self, **kwargs)
return render(request, self.template_name, {'common': common.infos })
Który z nich jest lepszy i dlaczego?