I'm trying to set up a simple modelform.  I have a projects with a
models.py, a views.py, a urls.py, and a forms.py.
All of these are in a single directory.

My urls.py is set up like so:

urlpatterns = patterns('myProject.views',
    (r'^$', 'intro'),
    ...
    (r'^samples/query/$', 'sample_query'),
    (r'^samples/create/$', 'sample_create'),    <-----  This is the
view in question


The class in my models.py is "Samples".
The view method in my views.py is "samples_create(request):"

My form method in forms.py is still skeletal, consisting only of the
following:

#
6   class sampleEntry(ModelForm):
7      class Meta:
8            model = Samples
9
10   addSample = sampleEntry(request.POST)
11   newSample =  addSample.save()
#

Into views.py, I'm importing the following:

from django.shortcuts import render_to_response, get_object_or_404
from myProject.models import Samples
from myProject import forms


Into forms.py, I'm importing the following:

from django.db import models
from django.forms import ModelForm
from myProject.models import Samples
from myProject import views

I know these imports look circular, and I'm wondering if that might be
part of the problem.  Anyway, when I run the url on the server, I get
this error:

Exception Type: ViewDoesNotExist at /myProject/samples/create/
Exception Value: Could not import myProject.views. Error was: cannot
import name sample_create

When I comment out the import views above, it gives me the following
error:

Exception Type: NameError at /QC_THISSS_01/samples/create/
Exception Value: name 'request' is not defined

I'm sure I'm turned around somewhere.  Can anyone help me back out
slowly...?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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.

Reply via email to