Python django.forms.forms 模块,Form() 实例源码

我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用django.forms.forms.Form()

项目:django-learning    作者:adoggie    | 项目源码 | 文件源码
def form_valid(self, form):
        return self.render_to_response(self.get_context_data(form=form))  #????????????????????Form????

    # def get_success_url(self):
    #   return reverse('tool-urlencode')
项目:django-learning    作者:adoggie    | 项目源码 | 文件源码
def form_valid(self, form):
        import urllib
        print 'data:', form.cleaned_data['opts']
        opts = form.cleaned_data['opts']
        if opts == 'encode':
            form.result =  urllib.quote(form.cleaned_data['text1']).strip()
        else:
            form.result = urllib.unquote(form.cleaned_data['text1']).strip()
        # return super(UrlEncodeView,self).form_valid(form)   # ????? success_url??
        return self.render_to_response(self.get_context_data(form=form))  #????????????????????Form????
        #???????????????????? Page??? {{ form.cleaned_data.s_to }}