On Jan 19, 6:25 pm, Lee Hinde <[EMAIL PROTECTED]> wrote:
> On Jan 19, 6:06 pm, Lee Hinde <[EMAIL PROTECTED]> wrote:
> >
>
> > Hi;
>
> > I have the admin site working, now I'm trying to add my first
> > standalone form.
>
> > Working from the 'simple' example from Chapter 7 of the book. I've
> > adapted it to my practice project.
>
> > After modifying the urls.py file I get this error when trying to
> > access anything, including admin:
>
> > Error while importing URLconf 'winesite.urls': name 'winesite' is not
> > defined
>
> > If I remove my 'search' line, admin/ works again.
>
> > mysite = winesite
> > myapp = winecomp
>
> > INSTALLED_APPS includes:     'winesite.winecomp',
>
> > so, my urls.py in the folder winesite is:
>
> > from django.conf.urls.defaults import *
> > from winesite.winecomp.views import search
>
> > urlpatterns = patterns('',
> >     # Example:
> >     # (r'^winesite/', include('winesite.foo.urls')),
>
> >     # Uncomment this for admin:
> >    (r'^admin/', include('django.contrib.admin.urls')),
> >    (r'^search/$', include(winesite.winecomp.views.search)),
>
> > )
>
> > I added the implied, but not specified import for my views.py file.
> > Removing it doesn't make a difference.
> > I've quoted the include on my 'search' url. I get a different error.
>
> > Inside winesite is the directory winecomp which has a file called
> > views.
>
> > I have a symlink to my project (added after I got this error and
> > suggested for a similar error (I thought) in this group. The admin app
> > doesn't seem to need it.)
>
> > Any suggestions on how to fix this error?
>
> Well I'm  too clever by half.
>
> If modify my urls.py file as presented: (modified for my app)
>
> from django.conf.urls.defaults import *
> # from winesite.winecomp import views
>
> urlpatterns = patterns('',
>     # Example:
>     # (r'^winesite/', include('winesite.foo.urls')),
>
>     # Uncomment this for admin:
>    (r'^admin/', include('django.contrib.admin.urls')),
>    (r'^search/$', include('winesite.winecomp.views.search')),
>
> )
>
> I seem to be ok.
>
> Of course, I get a different error, but I'll save that for a new
> thread.

Ok, same thread; it's still a urls.py error:

My error now is:

Error while importing URLconf 'winesite.winecomp.views.search': No
module named search

winecomp/views.py looks like this:

# Create your views here.
from django.db.models import Q
from django.shortcuts import render_to_response
from models import Winery

def search(request):
    query = request.GET.get('q', '')
    if query:
        qset = (
            Q(name__icontains=query)|
            Q(corporate_name__icontains=query)|
            Q(county__icontains=query)
            )
        results= Winery.objects.filter(qset).distinct()
    else:
        results = []
    return render_to_response("wineries/search.html",{
        "results":results,
        "query":query
    })

It's pretty much the same as the sample, just modified for my model.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to