Show me ------ Settings.py 2008/4/21, jeffself <[EMAIL PROTECTED]>: > > > I've got a project that contains two apps (elections and precincts). > My root urls.py looks like this: > from django.conf.urls.defaults import * > urlpatterns = patterns('', > (r'^elections/', include('elections.urls')), > (r'^precincts/', include('precincts.urls')), > (r'^admin/', include('django.contrib.admin.urls')), > ) > > My elections urls.py 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), > ) > > Each item on the elections page works correctly and has the correct > URL. > > My precincts urls.py file looks identical to the elections urls.py > file except it imports the precincts model and I changed the code from > election to precinct where necessary. I can bring up the Precincts > page but the items on the page have the wrong url. Instead of having > a url like http://localhost:8000/precincts/0001, the url looks like > http://localhost:8000/elections/0001. I can see that its looking back > at the root urls.py first and chooses the elections pattern. But why > is this? > > What do I need to change to make it look at precincts instead of > elections? I need to understand this so I can continue to separate my > program into separate apps as much as possible. Thanks! > > >
-- deSign thE fuTure http://www.freeis.cn/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---