After some more experiments i've decided its definetly some sort of problem with the URLs, if i comment one out the 2nd works and if i have them uncomment it doesn't.
Can anyone help me with this please? On 11 Aug, 19:30, When ideas fail <andrewkenyon...@gmail.com> wrote: > Hi, I have a strange error which i hope someone might be able to help > me with. Two of my urls seems to be conflicting somehow. i have these > two URLs: > > (r'^blog/(?P<slug>.+)/$', 'mysite.blog.views.title_view'), > (r'^blog/category/(?P<category>.+)/$', > 'mysite.blog.views.category_view'), > > -------------------------------------------------------------------------------------------------------------------------------------------- > > which relate to two views which summarised are like this: > > def title_view(request, category): > blog_post = Post.objects.get(post_slug=slug) > ........... > return render_to_response('blogSite/index.html', locals(), > context_instance=RequestContext(request)) > > def category_view(request, category): > blog_posts = Post.objects.filter > (post_tags__tag_name='category').order_by("-post_date") > ........... > return render_to_response('blogSite/index.html', locals(), > context_instance=RequestContext(request)) > > -------------------------------------------------------------------------------------------------------------------------------------------- > > Title view works fine but if i go on mysite.com/blog/category/General > I get the following error: > > File "C:\ProgLangs\Python25\lib\site-packages\django\core\handlers > \base.py" in get_response > 86. response = callback(request, *callback_args, > **calhttp://localhost:8080/akonline/blog/category/Andrew/lback_kwargs) > File "C:/Program Files/Apache2.2\mysite\blog\views.py" in title_view > 100. blog_post = Post.objects.get(post_slug=slug) > File "C:\ProgLangs\Python25\lib\site-packages\django\db\models > \manager.py" in get > 93. return self.get_query_set().get(*args, **kwargs) > File "C:\ProgLangs\Python25\lib\site-packages\django\db\models > \query.py" in get > 309. % self.model._meta.object_name) > > Exception Type: DoesNotExist at /blog/category/Andrew/ > Exception Value: Post matching query does not exist. > > The error mentions File "C:/Program Files/Apache2.2\mysite\blog > \views.py" in title_view > 100. blog_post = Post.objects.get(post_slug=slug) but this > line is in the first view which works. > > Category isn't going to match post)slug and it shouldn't so they seem > to be conflicting somehow. > I'd appreciate any help or even suggestion. > > Thank you > > Andrew --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---