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
UpdateViewCustom.py 文件源码
python
阅读 27
收藏 0
点赞 0
评论 0
评论列表
文章目录