7
में अनुरोध ऑब्जेक्ट प्राप्त करें मैं वर्तमान में उपयोगकर्ता द्वारा कक्षा-आधारित दृश्य में लॉग इन करना चाहता हूं। मैं अनुरोध ऑब्जेक्ट से उपयोगकर्ता को निकालने के द्वारा ऐसा कर सकता हूं, लेकिन मैं उस ऑब्जेक्ट को कैसे प्राप्त कर सकता हूं?कक्षा-आधारित दृश्य
class HomeView(TemplateView):
template_name='home.html'
def get_context_data(self, **kwargs):
context = super(HomeView, self).get_context_data(**kwargs)
context['username'] = request.user.username
return context