My project contains two apps, elections and precincts.  My main
urls.py file looks like this:

from django.conf.urls.defaults import *

urlpatterns = patterns('',
    (r'^precincts/', include('precincts.urls')),
    (r'^elections/', include('elections.urls')),
    (r'^admin/', include('django.contrib.admin.urls')),
)

The urls.py file under my precincts app looks like this:
from django.conf.urls.defaults import *
from precincts.models import Precinct
from django.views.generic import list_detail

precinct_list_info = {
        'queryset': Precinct.objects.all(),
        'allow_empty': True,
}

precinct_detail_info = {
        "queryset" : Precinct.objects.all(),
        "template_object_name" : "precinct",
}

urlpatterns = patterns('',
        (r'^$', list_detail.object_list, precinct_list_info),
)

urlpatterns += patterns('django.views.generic.list_detail',
        (r'^(?P<slug>[\w-]+)/$', 'object_detail', precinct_detail_info),
)

And my urls.py file under my elections app looks like this:
from django.conf.urls.defaults import *
from elections.models import Election
from django.views.generic import list_detail

election_list_info = {
    'queryset': Election.objects.all(),
    'allow_empty': True,
}

election_detail_info = {
    "queryset" : Election.objects.all(),
    "template_object_name" : "election",
}

urlpatterns = patterns('',
    (r'^$', list_detail.object_list, election_list_info),
)

urlpatterns += patterns('django.views.generic.list_detail',
    (r'^(?P<slug>[\w-]+)/$', 'object_detail', election_detail_info),
)

Both precincts and elections work in the browser. (http://localhost:
8000/precincts/, http://localhost:8000/elections/)
I get a list of precincts and a list of elections.  When I run the
mouse over the precincts, the correct url is displayed.  However, when
I run the mouse over the list of elections, the url looks like this:
http://localhost:8000/precincts/november-2007-general-election/
precincts shows up instead of elections.  I can reverse this by
putting elections ahead of precincts in the main urls.py file.  So
what am I doing wrong?  I've been looking at this for two hours.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to