Yati, Thanks so much for a fast response.
Here is my views.py code - I thought I'm returning an instance of HttpResponse. from django.http import HttpResponseRedirect from django.core.mail import send_mail from django.shortcuts import render_to_response from demoapp.contact.forms import ContactForm def contact(request): if request.method == 'POST': form = ContactForm(request.POST) if form.is_valid(): cd = form.cleaned_data send_mail( cd['subject'], cd['message'], cd.get('email', 'x...@example.com'), ['x...@example.com'], ) return HttpResponseRedirect('/contact/thanks/') else: form = ContactForm(initial={'subject': 'I love your site'}) return render_to_response('contact_form.html', {'form': form}) On Saturday, May 12, 2012 8:01:57 AM UTC-7, yati sagade wrote: > > My wild guess is that you're returning an instance of ContactForm in one > of your views. A view should return an HttpResponse object. Check your view > that uses this form > > On Sat, May 12, 2012 at 8:21 PM, django-user59 wrote: > >> Hi, >> >> I could not get the Chapter 7 "contact" form example to work. The >> public copy-paste is here: http://dpaste.com/747112/copy/ >> >> The message I get is: >> >> AttributeError at /contact/ >> 'ContactForm' object has no attribute 'status_code' >> >> My ContactForm definition is as follows: >> >> from django import forms >> >> class ContactForm(forms.Form): >> subject = forms.CharField(max_length=100) >> email = forms.EmailField(required=False, label='Your e-mail >> address') >> message = forms.CharField(widget=forms.Textarea) >> def clean_message(self): >> message = self.cleaned_data['message'] >> num_words = len(message.split()) >> if num_words < 4: >> raise forms.ValidationError("Not enough words!") >> return message >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To post to this group, send email to django-users@googlegroups.com. >> To unsubscribe from this group, send email to >> django-users+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/django-users?hl=en. >> >> > > > -- > Yati Sagade <http://twitter.com/yati_itay> > > Twitter: @yati_itay <http://twitter.com/yati_itay> > > Organizing member of TEDx EasternMetropolitanBypass > http://www.ted.com/tedx/events/4933 > > https://www.facebook.com/pages/TEDx-EasternMetropolitanBypass/337763226244869 > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/WwEBDDzNk1wJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.