Thank you. That cleared that up. Now getting the error. "global name 'ContactForm' is not defined" in my 'views.py' file. Any ideas?
On Dec 9, 3:35 pm, Daniel Roseman <[EMAIL PROTECTED]> wrote: > On Dec 9, 8:23 pm, prem1er <[EMAIL PROTECTED]> wrote: > > > Trying to follow along with the Form Tutorial on the Django site and > > I'm running into a problem. I keep getting the error page 'module' > > object has not attribute 'ContactForm', when I just simply copy and > > pasted the code from the tutorial into my models.py. Here is my > > source. I feel like it has something to do with my urls.py since I'm > > trying to use the template system. > > -------------------------------------------- > > Models.py > > > from django import forms > > > class ContactForm(forms.Form): > > subject = forms.CharField(max_length=100) > > message = forms.CharField() > > sender = forms.EmailField() > > cc_myself = forms.BooleanField(required=False) > > ---------------------------------------------------- > > urls.py > > > from django.conf.urls.defaults import * > > from xxx django.contrib import admin > > > # Uncomment the next two lines to enable the admin: > > #admin.autodiscover() > > > urlpatterns = patterns('xxx.register.views', > > (r'^$', 'ContactForm'), > > > # Uncomment the next line to enable the admin: > > #(r'^admin/(.*)', admin.site.root), > > > # Uncomment the admin/doc line below and add > > 'django.contrib.admindocs' > > # to INSTALLED_APPS to enable admin documentation: > > # (r'^admin/doc/', include('django.contrib.admindocs.urls')), > > > ) > > ---------------------------------------------------------------- > > views.py > > > def contact(request): > > <snip> > > You're right in thinking the problem is in your urls.py. It's here: > urlpatterns = patterns('xxx.register.views', > (r'^$', 'ContactForm'), > > This is looking in the views.py for a view called 'ContactForm'. But > your view isn't called that, it's called 'contact', so that's what you > should put in the second line above. > > -- > DR. --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---