I don't think thats it because if I reverse the order of the url's in the root urls.py file and put precincts before elections, then precincts items work correctly but the election items point to precincts rather than elections.
On Apr 21, 3:52 pm, Michael <[EMAIL PROTECTED]> wrote: > How are you getting the URL? Is there something in your models that is > defining the absolute URL? or are you using the Revese lookup? > > Chances are because they are just copies of one another that you forgot to > change one of the files and they still have the get_absolute_url referring > to the elections one, > > Michael > > On Mon, Apr 21, 2008 at 12:48 PM, 小龙 <[EMAIL PROTECTED]> wrote: > > 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 likehttp://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 -~----------~----~----~----~------~----~------~--~---