forms.py 文件源码

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

项目:grical 作者: wikical 项目源码 文件源码
def get_context(self):
        """
        Return the context used to render the templates for the email
        subject and body.

        By default, this context includes:

        * All of the validated values in the form, as variables of the
          same names as their fields.

        * The current ``Site`` object, as the variable ``site``.

        * Any additional variables added by context processors (this
          will be a ``RequestContext``).

        """
        if not self.is_valid():
            raise ValueError("Cannot generate Context from invalid contact form")
        return dict(self.cleaned_data, site=Site.objects.get_current())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号