我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用django.forms.forms.Form()。
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')
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 }}