UpdateViewCustom.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:Django-Web-Development-with-Python 作者: PacktPublishing 项目源码 文件源码
def get_context_data(self, **kwargs): 
        # This line is the method we use to send data to the template.
        context = super(UpdateViewCustom, self).get_context_data(**kwargs) 
        # In this line, we perform the super class method to send normal data from the CBV UpdateView.
        model_name = self.model._meta.verbose_name.title() 
        # In this line, we get the verbose_name property of the defined model.
        context['model_name'] = model_name 
        # In this line, we send the verbose_name property to the template.
        context['url_name'] = self.url_name \
        # This line allows us to send the name of our URL to the template.
        return context
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号